[Commits] 330121d4ea8: MDEV-27021 Add explicit indication of SHOW EXPLAIN/ANALYZE
revision-id: 330121d4ea8164d88a095bcd65df86c0d928133d (mariadb-10.6.1-357-g330121d4ea8) parent(s): cc5d67c026da9fce31f614fd17652edbff5b58ba author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2022-03-15 12:16:42 +0300 message: MDEV-27021 Add explicit indication of SHOW EXPLAIN/ANALYZE Step #1: add 'filtered' column. - Based on a part of Oleg Smirnov's patch - Added test coverage - A lot of test updates. --- mysql-test/include/ctype_utf8_ilseq.inc | 12 +- mysql-test/include/explain_utils.inc | 6 +- mysql-test/include/gis_keys.inc | 2 +- mysql-test/include/icp_tests.inc | 12 +- mysql-test/include/index_merge1.inc | 10 +- mysql-test/include/index_merge2.inc | 6 +- mysql-test/include/index_merge_ror_cpk.inc | 2 +- mysql-test/include/min_null_cond.inc | 20 +- mysql-test/include/mix1.inc | 6 +- mysql-test/include/mix2.inc | 30 +- mysql-test/include/partition_mrr.inc | 2 +- mysql-test/include/varchar.inc | 34 +- mysql-test/main/analyze_format_json.result | 18 +- mysql-test/main/analyze_stmt.result | 196 +-- mysql-test/main/analyze_stmt_orderby.result | 40 +- mysql-test/main/analyze_stmt_privileges2.result | 1580 +++++++++---------- mysql-test/main/analyze_stmt_slow_query_log.result | 12 +- mysql-test/main/ansi.result | 32 +- mysql-test/main/aria_icp_debug.result | 4 +- mysql-test/main/auto_increment.result | 4 +- mysql-test/main/bench_count_distinct.result | 4 +- mysql-test/main/binary.result | 8 +- mysql-test/main/brackets.result | 136 +- mysql-test/main/case.result | 76 +- mysql-test/main/cast.result | 16 +- mysql-test/main/compare.result | 22 +- mysql-test/main/compress.result | 176 +-- mysql-test/main/create.result | 4 +- mysql-test/main/cte_nonrecursive.result | 334 ++-- mysql-test/main/cte_recursive.result | 326 ++-- mysql-test/main/ctype_binary.result | 68 +- mysql-test/main/ctype_collate.result | 52 +- mysql-test/main/ctype_cp1250_ch.result | 20 +- mysql-test/main/ctype_cp1251.result | 28 +- mysql-test/main/ctype_latin1.result | 96 +- mysql-test/main/ctype_latin2_ch.result | 20 +- mysql-test/main/ctype_tis620.result | 40 +- mysql-test/main/ctype_uca.result | 156 +- mysql-test/main/ctype_uca_innodb.result | 28 +- mysql-test/main/ctype_ucs.result | 112 +- mysql-test/main/ctype_utf16.result | 32 +- mysql-test/main/ctype_utf16_uca.result | 20 +- mysql-test/main/ctype_utf16le.result | 32 +- mysql-test/main/ctype_utf32.result | 32 +- mysql-test/main/ctype_utf32_uca.result | 20 +- mysql-test/main/ctype_utf8.result | 222 +-- mysql-test/main/ctype_utf8mb4.result | 34 +- mysql-test/main/ctype_utf8mb4_heap.result | 34 +- mysql-test/main/ctype_utf8mb4_innodb.result | 34 +- mysql-test/main/ctype_utf8mb4_myisam.result | 34 +- mysql-test/main/ctype_utf8mb4_uca.result | 16 +- mysql-test/main/custom_aggregates_i_s.result | 32 +- mysql-test/main/date_formats.result | 4 +- mysql-test/main/default.result | 4 +- mysql-test/main/delete.result | 8 +- mysql-test/main/delete_innodb.result | 6 +- mysql-test/main/delete_use_source.test | 2 +- mysql-test/main/derived.result | 344 ++-- mysql-test/main/derived_cond_pushdown.result | 1644 ++++++++++---------- mysql-test/main/derived_opt.result | 276 ++-- mysql-test/main/derived_opt.test | 2 +- mysql-test/main/derived_split_innodb.result | 104 +- mysql-test/main/derived_view.result | 1120 ++++++------- mysql-test/main/desc_index_range.result | 32 +- mysql-test/main/distinct.result | 200 +-- mysql-test/main/dyncol.result | 44 +- mysql-test/main/empty_string_literal.result | 16 +- mysql-test/main/endspace.result | 16 +- mysql-test/main/error_simulation.result | 6 +- mysql-test/main/error_simulation.test | 2 +- mysql-test/main/except.result | 64 +- mysql-test/main/except_all.result | 66 +- mysql-test/main/explain.result | 210 +-- mysql-test/main/explain.test | 2 +- mysql-test/main/explain_innodb.result | 6 +- mysql-test/main/explain_json.result | 62 +- mysql-test/main/explain_non_select.result | 150 +- mysql-test/main/explain_slowquerylog.result | 4 +- mysql-test/main/ext_key_noPK_6794.result | 1 + mysql-test/main/fetch_first.result | 34 +- mysql-test/main/fulltext.result | 86 +- mysql-test/main/fulltext_order_by.result | 4 +- mysql-test/main/func_analyse.result | 6 +- mysql-test/main/func_compress.result | 16 +- mysql-test/main/func_concat.result | 6 +- mysql-test/main/func_crypt.result | 4 +- mysql-test/main/func_debug.result | 6 +- mysql-test/main/func_default.result | 8 +- mysql-test/main/func_encrypt.result | 8 +- mysql-test/main/func_gconcat.result | 34 +- mysql-test/main/func_group.result | 362 ++--- mysql-test/main/func_group_innodb.result | 50 +- mysql-test/main/func_if.result | 8 +- mysql-test/main/func_in.result | 236 +-- mysql-test/main/func_isnull.result | 28 +- mysql-test/main/func_json.result | 6 +- mysql-test/main/func_like.result | 24 +- mysql-test/main/func_math.result | 52 +- mysql-test/main/func_misc.result | 24 +- mysql-test/main/func_op.result | 8 +- mysql-test/main/func_regexp.result | 4 +- mysql-test/main/func_regexp_pcre.result | 8 +- mysql-test/main/func_set.result | 4 +- mysql-test/main/func_str.result | 266 ++-- mysql-test/main/func_system.result | 4 +- mysql-test/main/func_test.result | 44 +- mysql-test/main/func_time.result | 24 +- mysql-test/main/func_time_hires.result | 4 +- mysql-test/main/func_weight_string.result | 12 +- mysql-test/main/gis-rt-precise.result | 8 +- mysql-test/main/gis-rtree.result | 44 +- mysql-test/main/gis.result | 62 +- mysql-test/main/grant_explain_non_select.result | 36 +- mysql-test/main/greedy_optimizer.result | 672 ++++---- mysql-test/main/group_by.result | 352 ++--- mysql-test/main/group_by.test | 2 +- mysql-test/main/group_by_innodb.result | 12 +- mysql-test/main/group_min_max.result | 1206 +++++++------- mysql-test/main/group_min_max.test | 94 +- mysql-test/main/group_min_max_innodb.result | 44 +- mysql-test/main/having.result | 40 +- mysql-test/main/having_cond_pushdown.result | 344 ++-- mysql-test/main/ignored_index.result | 84 +- mysql-test/main/in_subq_cond_pushdown.result | 328 ++-- mysql-test/main/index_intersect.result | 94 +- mysql-test/main/index_intersect.test | 46 +- mysql-test/main/index_intersect_innodb.result | 94 +- mysql-test/main/index_merge_innodb.result | 106 +- mysql-test/main/index_merge_innodb.test | 4 +- mysql-test/main/index_merge_myisam.result | 572 +++---- mysql-test/main/information_schema.result | 90 +- mysql-test/main/init_connection_query_cache.result | 4 +- mysql-test/main/innodb_bug878769.result | 6 +- mysql-test/main/innodb_ext_key,off.rdiff | 108 +- mysql-test/main/innodb_ext_key.result | 142 +- mysql-test/main/innodb_ext_key.test | 22 +- mysql-test/main/innodb_icp.result | 84 +- mysql-test/main/innodb_icp_debug.result | 4 +- mysql-test/main/innodb_mrr_cpk.result | 62 +- mysql-test/main/innodb_mrr_cpk.test | 2 +- mysql-test/main/insert_returning.result | 64 +- mysql-test/main/insert_select.result | 6 +- mysql-test/main/insert_update.result | 8 +- mysql-test/main/intersect.result | 104 +- mysql-test/main/intersect_all.result | 102 +- mysql-test/main/invisible_field.result | 14 +- mysql-test/main/invisible_field_debug.result | 12 +- mysql-test/main/join.result | 850 +++++----- mysql-test/main/join_cache.result | 1320 ++++++++-------- mysql-test/main/join_cache.test | 4 +- mysql-test/main/join_nested.result | 318 ++-- mysql-test/main/join_nested.test | 6 +- mysql-test/main/join_nested_jcl6.result | 358 ++--- mysql-test/main/join_optimizer.result | 6 +- mysql-test/main/join_outer.result | 476 +++--- mysql-test/main/join_outer_innodb.result | 132 +- mysql-test/main/join_outer_jcl6.result | 476 +++--- mysql-test/main/key.result | 54 +- mysql-test/main/key_cache.result | 60 +- mysql-test/main/key_diff.result | 6 +- mysql-test/main/key_primary.result | 8 +- mysql-test/main/limit.result | 16 +- mysql-test/main/limit_rows_examined.result | 240 +-- mysql-test/main/long_unique.result | 6 +- mysql-test/main/mdev-25830.result | 16 +- mysql-test/main/mdev13607.result | 832 +++++----- mysql-test/main/merge.result | 54 +- mysql-test/main/mix2_myisam.result | 140 +- mysql-test/main/mrr_derived_crash_4610.result | 12 +- mysql-test/main/mrr_icp_extra.result | 164 +- mysql-test/main/mrr_icp_extra.test | 10 +- mysql-test/main/multi_update.result | 22 +- mysql-test/main/myisam.result | 166 +- .../main/myisam_explain_non_select_all.result | 1084 ++++++------- mysql-test/main/myisam_icp.result | 114 +- mysql-test/main/myisam_icp_debug.result | 4 +- mysql-test/main/myisam_mrr.result | 74 +- mysql-test/main/myisam_optimize.result | 4 +- mysql-test/main/mysql_client_test.result | 160 +- mysql-test/main/negation_elimination.result | 112 +- mysql-test/main/null.result | 80 +- mysql-test/main/null_key.result | 170 +- mysql-test/main/odbc.result | 4 +- mysql-test/main/olap.result | 8 +- mysql-test/main/opt_trace.result | 268 ++-- mysql-test/main/opt_trace_index_merge.result | 12 +- .../main/opt_trace_index_merge_innodb.result | 4 +- mysql-test/main/opt_tvc.result | 278 ++-- mysql-test/main/order_by.result | 428 ++--- mysql-test/main/order_by.test | 2 +- mysql-test/main/order_by_innodb.result | 36 +- mysql-test/main/order_by_innodb.test | 6 +- mysql-test/main/order_by_optimizer.result | 10 +- mysql-test/main/order_by_optimizer_innodb.result | 16 +- mysql-test/main/order_by_zerolength-4285.result | 4 +- mysql-test/main/outfile.result | Bin 2323 -> 2339 bytes mysql-test/main/parser.result | 8 +- mysql-test/main/partition.result | 44 +- mysql-test/main/partition_innodb.test | 4 +- mysql-test/main/partition_mrr_aria.result | 40 +- mysql-test/main/partition_mrr_innodb.result | 40 +- mysql-test/main/partition_mrr_myisam.result | 52 +- mysql-test/main/partition_order.result | 4 +- mysql-test/main/partition_pruning.result | 36 +- mysql-test/main/partition_range.result | 24 +- mysql-test/main/pool_of_threads.result | 176 +-- mysql-test/main/precedence_bugs.result | 4 +- mysql-test/main/processlist_notembedded.result | 4 +- mysql-test/main/ps.result | 172 +- mysql-test/main/ps.test | 6 +- mysql-test/main/ps_11bugs.result | 10 +- mysql-test/main/ps_1general.result | 10 +- mysql-test/main/ps_2myisam.result | 5 +- mysql-test/main/ps_3innodb.result | 5 +- mysql-test/main/ps_4heap.result | 5 +- mysql-test/main/ps_5merge.result | 10 +- mysql-test/main/query_cache.result | 4 +- mysql-test/main/range.result | 668 ++++---- mysql-test/main/range.test | 30 +- mysql-test/main/range_debug.result | 4 +- mysql-test/main/range_innodb.result | 38 +- mysql-test/main/range_innodb.test | 8 +- mysql-test/main/range_mrr_icp.result | 668 ++++---- mysql-test/main/range_notembedded.result | 20 +- mysql-test/main/range_vs_index_merge.result | 368 ++--- mysql-test/main/range_vs_index_merge.test | 10 +- mysql-test/main/range_vs_index_merge_innodb.result | 368 ++--- mysql-test/main/row.result | 82 +- mysql-test/main/rowid_filter.result | 186 +-- mysql-test/main/rowid_filter.test | 4 +- mysql-test/main/rowid_filter_innodb.result | 292 ++-- mysql-test/main/rowid_filter_innodb_debug.result | 6 +- mysql-test/main/rowid_filter_myisam_debug.result | 6 +- mysql-test/main/rowid_order_innodb.result | 4 +- mysql-test/main/rownum.result | 84 +- mysql-test/main/second_frac-9175.result | 4 +- mysql-test/main/select.result | 740 ++++----- mysql-test/main/select_debug.result | 6 +- mysql-test/main/select_found.result | 6 +- mysql-test/main/select_jcl6.result | 740 ++++----- mysql-test/main/select_pkeycache.result | 740 ++++----- mysql-test/main/select_safe.result | 12 +- mysql-test/main/selectivity.result | 434 +++--- mysql-test/main/selectivity_no_engine.result | 84 +- mysql-test/main/set_operation.result | 242 +-- mysql-test/main/set_operation_oracle.result | 72 +- mysql-test/main/set_statement.result | 12 +- mysql-test/main/show_analyze.result | 160 +- mysql-test/main/show_analyze_json.result | 32 +- mysql-test/main/show_analyze_partition.result | 39 + mysql-test/main/show_analyze_partition.test | 60 + mysql-test/main/show_explain.result | 530 +++---- mysql-test/main/show_explain_json.result | 72 +- mysql-test/main/show_explain_non_select.result | 14 +- mysql-test/main/show_explain_ps.result | 4 +- mysql-test/main/single_delete_update.result | 16 +- mysql-test/main/single_delete_update.test | 8 +- mysql-test/main/sp-anchor-row-type-cursor.result | 4 +- mysql-test/main/sp-anchor-row-type-table.result | 4 +- mysql-test/main/sp-row.result | 4 +- mysql-test/main/sp.result | 28 +- mysql-test/main/ssl.result | 176 +-- mysql-test/main/ssl_compress.result | 176 +-- mysql-test/main/stat_tables.result | 114 +- mysql-test/main/stat_tables_disabled.result | 24 +- mysql-test/main/stat_tables_disabled.test | 2 +- mysql-test/main/stat_tables_innodb.result | 114 +- mysql-test/main/statistics.result | 8 +- mysql-test/main/statistics_json.result | 204 +-- mysql-test/main/statistics_upgrade_not_done.result | 12 +- mysql-test/main/status.result | 12 +- mysql-test/main/subselect.result | 890 +++++------ mysql-test/main/subselect.test | 2 +- mysql-test/main/subselect2.result | 66 +- mysql-test/main/subselect3.result | 366 ++--- mysql-test/main/subselect3_jcl6.result | 366 ++--- mysql-test/main/subselect4.result | 1192 +++++++------- mysql-test/main/subselect4.test | 10 +- mysql-test/main/subselect_cache.result | 24 +- mysql-test/main/subselect_exists2in.result | 180 +-- mysql-test/main/subselect_exists2in_costmat.result | 6 +- mysql-test/main/subselect_extra.result | 136 +- mysql-test/main/subselect_extra_no_semijoin.result | 136 +- mysql-test/main/subselect_innodb.result | 84 +- mysql-test/main/subselect_innodb.test | 2 +- mysql-test/main/subselect_mat.result | 836 +++++----- mysql-test/main/subselect_mat_cost.result | 132 +- mysql-test/main/subselect_mat_cost_bugs.result | 138 +- mysql-test/main/subselect_no_exists_to_in.result | 882 +++++------ mysql-test/main/subselect_no_mat.result | 862 +++++----- mysql-test/main/subselect_no_opts.result | 866 +++++------ mysql-test/main/subselect_no_scache.result | 890 +++++------ mysql-test/main/subselect_no_semijoin.result | 866 +++++------ mysql-test/main/subselect_partial_match.result | 372 ++--- mysql-test/main/subselect_sj.result | 764 ++++----- mysql-test/main/subselect_sj2.result | 226 +-- mysql-test/main/subselect_sj2.test | 8 +- mysql-test/main/subselect_sj2_jcl6.result | 266 ++-- mysql-test/main/subselect_sj2_mat.result | 394 ++--- mysql-test/main/subselect_sj_jcl6.result | 848 +++++----- mysql-test/main/subselect_sj_mat.result | 804 +++++----- mysql-test/main/subselect_sj_mat.test | 14 +- mysql-test/main/subselect_sj_nonmerged.result | 76 +- mysql-test/main/symlink-aria-11902.result | 4 +- mysql-test/main/symlink-myisam-11902.result | 4 +- mysql-test/main/table_elim.result | 288 ++-- mysql-test/main/table_elim_debug.result | 18 +- mysql-test/main/table_value_constr.result | 754 ++++----- mysql-test/main/temporal_literal.result | 24 +- mysql-test/main/tmp_table_count-7586.result | 24 +- mysql-test/main/type_bit.result | 40 +- mysql-test/main/type_bit_innodb.result | 24 +- mysql-test/main/type_bit_innodb.test | 2 +- mysql-test/main/type_blob.result | 48 +- mysql-test/main/type_date.result | 192 +-- mysql-test/main/type_date_round.result | 8 +- mysql-test/main/type_datetime.result | 140 +- mysql-test/main/type_datetime_round.result | 8 +- mysql-test/main/type_decimal.result | 48 +- mysql-test/main/type_float.result | 76 +- mysql-test/main/type_hex_hybrid.result | 4 +- mysql-test/main/type_int.result | 80 +- mysql-test/main/type_newdecimal.result | 44 +- mysql-test/main/type_time.result | 364 ++--- mysql-test/main/type_time_6065.result | 502 +++--- mysql-test/main/type_time_round.result | 8 +- mysql-test/main/type_timestamp.result | 60 +- mysql-test/main/type_timestamp.test | 4 +- mysql-test/main/type_uint.result | 6 +- mysql-test/main/type_varchar.result | 184 +-- mysql-test/main/type_year.result | 24 +- mysql-test/main/udf.result | 32 +- mysql-test/main/union.result | 140 +- mysql-test/main/update.result | 4 +- mysql-test/main/update_use_source.result | 48 +- mysql-test/main/user_var.result | 24 +- mysql-test/main/varbinary.result | 8 +- mysql-test/main/variables.result | 40 +- mysql-test/main/view.result | 404 ++--- mysql-test/main/view_grant.result | 32 +- mysql-test/main/win.result | 88 +- mysql-test/main/win_big-mdev-11697.result | 12 +- mysql-test/main/win_ntile.result | 6 +- mysql-test/main/xtradb_mrr.result | 24 +- mysql-test/main/xtradb_mrr.test | 2 +- sql/sql_class.cc | 13 +- sql/sql_explain.cc | 34 +- sql/sql_select.cc | 3 +- sql/sql_show.cc | 4 + tests/mysql_client_test.c | 50 +- 350 files changed, 24476 insertions(+), 24371 deletions(-) diff --git a/mysql-test/include/ctype_utf8_ilseq.inc b/mysql-test/include/ctype_utf8_ilseq.inc index 3586946659e..98edb86d596 100644 --- a/mysql-test/include/ctype_utf8_ilseq.inc +++ b/mysql-test/include/ctype_utf8_ilseq.inc @@ -29,33 +29,33 @@ INSERT INTO t1 (ch) VALUES (_utf8 0x61D680); SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; diff --git a/mysql-test/include/explain_utils.inc b/mysql-test/include/explain_utils.inc index 15376b76610..14d900d4982 100644 --- a/mysql-test/include/explain_utils.inc +++ b/mysql-test/include/explain_utils.inc @@ -37,7 +37,7 @@ if ($select) { if ($innodb) { if ($no_rows) { ---replace_column 9 X +--replace_column 10 X } } --eval EXPLAIN $query @@ -50,7 +50,7 @@ FLUSH STATUS; FLUSH TABLES; if ($innodb) { if ($no_rows) { ---replace_column 9 X 10 X +--replace_column 10 X 11 X } } --eval EXPLAIN EXTENDED $query @@ -90,7 +90,7 @@ FLUSH STATUS; FLUSH TABLES; if ($innodb) { if ($no_rows) { ---replace_column 9 X 10 X +--replace_column 10 X 11 X } } --eval EXPLAIN EXTENDED $select diff --git a/mysql-test/include/gis_keys.inc b/mysql-test/include/gis_keys.inc index 388c7b45898..adb157277eb 100644 --- a/mysql-test/include/gis_keys.inc +++ b/mysql-test/include/gis_keys.inc @@ -33,7 +33,7 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); diff --git a/mysql-test/include/icp_tests.inc b/mysql-test/include/icp_tests.inc index d78fe0dd209..a2327f5782f 100644 --- a/mysql-test/include/icp_tests.inc +++ b/mysql-test/include/icp_tests.inc @@ -228,7 +228,7 @@ EXPLAIN SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' and i1 > 2; SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' and i1 > 2; ---replace_column 9 100 +--replace_column 10 100 EXPLAIN SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' or i1 > 2; SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' or i1 > 2; @@ -461,7 +461,7 @@ INSERT INTO t2 VALUES (15,4); set @save_optimizer_switch= @@optimizer_switch; set optimizer_switch='semijoin=off'; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10); @@ -696,7 +696,7 @@ INSERT INTO t1 VALUES ('fkxdmbdkpjdanpje','o'), ('f','Pennsylvan'), ('Virginia','ei'); SET SESSION optimizer_switch='index_condition_pushdown=off'; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM t1 WHERE NOT(b = 'Texas') AND b BETWEEN 'wy' AND 'y' OR b = 'Pennsylvania' @@ -706,7 +706,7 @@ SELECT * FROM t1 ORDER BY a; SET SESSION optimizer_switch='index_condition_pushdown=on'; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM t1 WHERE NOT(b = 'Texas') AND b BETWEEN 'wy' AND 'y' OR b = 'Pennsylvania' @@ -731,7 +731,7 @@ INSERT INTO t2 VALUES insert into t2 select seq from seq_1_to_100; SET SESSION optimizer_switch='index_condition_pushdown=off'; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND (t1.b<0 OR t1.b>0) HAVING t1.c != 5 ORDER BY t1.c; @@ -739,7 +739,7 @@ SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND (t1.b<0 OR t1.b>0) HAVING t1.c != 5 ORDER BY t1.c; SET SESSION optimizer_switch='index_condition_pushdown=on'; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND (t1.b<0 OR t1.b>0) HAVING t1.c != 5 ORDER BY t1.c; diff --git a/mysql-test/include/index_merge1.inc b/mysql-test/include/index_merge1.inc index 43f57375a4e..3450a50e9f8 100644 --- a/mysql-test/include/index_merge1.inc +++ b/mysql-test/include/index_merge1.inc @@ -332,7 +332,7 @@ update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500; # The next query will not use index i7 in intersection if the OS doesn't # support file sizes > 2GB. (ha_myisam::ref_length depends on this and index # scan cost estimates depend on ha_myisam::ref_length) ---replace_column 9 # +--replace_column 10 # --replace_result "4,4,4,4,4,4,4" X "4,4,4,4,4,4" X "i6,i7" "i6,i7?" "i6" "i6,i7?" explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) from t0 as A straight_join t0 as B @@ -401,9 +401,9 @@ create table t3 ( key(a),key(b) ) engine=merge union=(t1,t2); ---replace_column 9 # +--replace_column 10 # explain select * from t1 where a=1 and b=1; ---replace_column 9 # +--replace_column 10 # explain select * from t3 where a=1 and b=1; drop table t1, t2, t3; @@ -474,7 +474,7 @@ insert into t2 select * from t1; --echo must use sort-union rather than union: ---replace_column 9 # +--replace_column 10 # explain select * from t1 where a=4 or b=4; --sorted_result select * from t1 where a=4 or b=4; @@ -482,7 +482,7 @@ select * from t1 where a=4 or b=4; select * from t1 ignore index(a,b) where a=4 or b=4; --echo must use union, not sort-union: ---replace_column 9 # +--replace_column 10 # explain select * from t2 where a=2 or b=2; --sorted_result select * from t2 where a=2 or b=2; diff --git a/mysql-test/include/index_merge2.inc b/mysql-test/include/index_merge2.inc index ecb16f54bbc..28d17cc0568 100644 --- a/mysql-test/include/index_merge2.inc +++ b/mysql-test/include/index_merge2.inc @@ -100,7 +100,7 @@ insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b) analyze table t1; select count(*) from t1; ---replace_column 9 REF +--replace_column 10 REF --replace_result i2,i1 i1,i2 explain select count(*) from t1 where key1a = 2 and key1b is null and key2a = 2 and key2b is null; @@ -108,7 +108,7 @@ explain select count(*) from t1 where select count(*) from t1 where key1a = 2 and key1b is null and key2a = 2 and key2b is null; ---replace_column 9 REF +--replace_column 10 REF --replace_result i3,i1 i1,i3 explain select count(*) from t1 where key1a = 2 and key1b is null and key3a = 2 and key3b is null; @@ -314,7 +314,7 @@ insert into t1 select 10000+key1, 10000+key2,10000+key3 from t1; analyze table t1; # to test the bug, the following must use "sort_union": ---replace_column 9 REF +--replace_column 10 REF explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); drop table t1; diff --git a/mysql-test/include/index_merge_ror_cpk.inc b/mysql-test/include/index_merge_ror_cpk.inc index 9ebca3cd22f..97f636df19f 100644 --- a/mysql-test/include/index_merge_ror_cpk.inc +++ b/mysql-test/include/index_merge_ror_cpk.inc @@ -73,7 +73,7 @@ select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1; explain select * from t1 where badkey=1 and key1=10; set @tmp_index_merge_ror_cpk=@@optimizer_switch; set optimizer_switch='extended_keys=off'; ---replace_column 9 ROWS +--replace_column 10 ROWS explain select * from t1 where pk1 < 7500 and key1 = 10; set optimizer_switch=@tmp_index_merge_ror_cpk; diff --git a/mysql-test/include/min_null_cond.inc b/mysql-test/include/min_null_cond.inc index c958fc7075a..c2cd835643b 100644 --- a/mysql-test/include/min_null_cond.inc +++ b/mysql-test/include/min_null_cond.inc @@ -1,51 +1,51 @@ ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x EXPLAIN SELECT MIN( a ) FROM t1 WHERE a = NULL; SELECT MIN( a ) FROM t1 WHERE a = NULL; ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x EXPLAIN SELECT MIN( a ) FROM t1 WHERE a <> NULL; SELECT MIN( a ) FROM t1 WHERE a <> NULL; ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x EXPLAIN SELECT MIN( a ) FROM t1 WHERE a > NULL; SELECT MIN( a ) FROM t1 WHERE a > NULL; ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x EXPLAIN SELECT MIN( a ) FROM t1 WHERE a < NULL; SELECT MIN( a ) FROM t1 WHERE a < NULL; if (!$skip_null_safe_test) { ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x EXPLAIN SELECT MIN( a ) FROM t1 WHERE a <=> NULL; SELECT MIN( a ) FROM t1 WHERE a <=> NULL; } ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x EXPLAIN SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10; SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10; ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x EXPLAIN SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL; SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL; ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x EXPLAIN SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL; SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL; ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x EXPLAIN SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0); SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0); ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x EXPLAIN SELECT MIN( a ) FROM t1 WHERE a IS NULL; SELECT MIN( a ) FROM t1 WHERE a IS NULL; diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc index 2ec0868c39e..17088cc38f7 100644 --- a/mysql-test/include/mix1.inc +++ b/mysql-test/include/mix1.inc @@ -469,7 +469,7 @@ EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5'; SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5'; DELETE FROM t1; --echo # Masking (#) number in "rows" column of the following EXPLAIN output, as it may vary (bug#47746). ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5'; SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5'; @@ -754,14 +754,14 @@ set @@sort_buffer_size=8192; SELECT COUNT(*) FROM t1; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT COUNT(*) FROM t1 WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; SELECT COUNT(*) FROM t1 WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c) WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; diff --git a/mysql-test/include/mix2.inc b/mysql-test/include/mix2.inc index 5d7598694a6..ff9c9b6535d 100644 --- a/mysql-test/include/mix2.inc +++ b/mysql-test/include/mix2.inc @@ -103,11 +103,11 @@ update ignore t1 set id=id+1; # This will change all rows select * from t1; update ignore t1 set id=1023 where id=1010; select * from t1 where parent_id=102; ---replace_column 9 # +--replace_column 10 # explain select level from t1 where level=1; ---replace_column 9 # +--replace_column 10 # explain select level,id from t1 where level=1; ---replace_column 9 # +--replace_column 10 # explain select level,id,parent_id from t1 where level=1; select level,id from t1 where level=1; select level,id,parent_id from t1 where level=1; @@ -456,7 +456,7 @@ update ignore t1 set id=id+1; # This will change all rows select * from t1; update ignore t1 set id=1023 where id=1010; select * from t1 where parent_id=102; ---replace_column 9 # +--replace_column 10 # explain select level from t1 where level=1; select level,id from t1 where level=1; select level,id,parent_id from t1 where level=1; @@ -561,7 +561,7 @@ DROP TABLE t1; eval create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = $engine_type; insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); ---replace_column 9 # +--replace_column 10 # explain select * from t1 where a > 0 and a < 50; drop table t1; @@ -692,21 +692,21 @@ drop table t1; eval create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=$engine_type; insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); ---replace_column 9 # +--replace_column 10 # explain select * from t1 order by a; ---replace_column 9 # +--replace_column 10 # explain select * from t1 order by b; ---replace_column 9 # +--replace_column 10 # explain select * from t1 order by c; ---replace_column 9 # +--replace_column 10 # explain select a from t1 order by a; ---replace_column 9 # +--replace_column 10 # explain select b from t1 order by b; ---replace_column 9 # +--replace_column 10 # explain select a,b from t1 order by b; ---replace_column 9 # +--replace_column 10 # explain select a,b from t1; ---replace_column 9 # +--replace_column 10 # explain select a,b,c from t1; drop table t1; @@ -972,10 +972,10 @@ insert into t1 (a) select b from t2; insert into t2 (a) select b from t1; insert into t1 (a) select b from t2; select count(*) from t1; ---replace_column 9 # +--replace_column 10 # explain select * from t1 where c between 1 and 2500; update t1 set c=a; ---replace_column 9 # +--replace_column 10 # explain select * from t1 where c between 1 and 2500; drop table t1,t2; diff --git a/mysql-test/include/partition_mrr.inc b/mysql-test/include/partition_mrr.inc index 188bc50147f..ad692896682 100644 --- a/mysql-test/include/partition_mrr.inc +++ b/mysql-test/include/partition_mrr.inc @@ -39,7 +39,7 @@ from t1 A, t1 B; set @save_optimizer_switch=@@optimizer_switch; set optimizer_switch='mrr=on'; ---replace_column 9 # +--replace_column 10 # explain select * from t3 force index (key_col) where key_col < 3; select * from t3 force index (key_col) where key_col < 3; diff --git a/mysql-test/include/varchar.inc b/mysql-test/include/varchar.inc index 7add7113b8d..4fe118a7034 100644 --- a/mysql-test/include/varchar.inc +++ b/mysql-test/include/varchar.inc @@ -73,17 +73,17 @@ select count(*) from t1 where t like 'a%'; select count(*) from t1 where v like 'a %'; # Test results differ for BDB, see comments in bdb.test # and they are also different from MySAM test results. ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where v='a '; ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where c='a '; ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where t='a '; ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where v like 'a%'; ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where v between 'a' and 'a '; ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; # Which duplicate entry triggers error is not deterministic. @@ -93,7 +93,7 @@ alter table t1 add unique(v); show warnings; alter table t1 add key(v); select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; ---replace_column 6 # 9 # 10 # +--replace_column 7 # 10 # 11 # explain select * from t1 where v='a'; # GROUP BY @@ -122,15 +122,15 @@ select count(*) from t1 where v between 'a' and 'a '; select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; select count(*) from t1 where v like 'a%'; select count(*) from t1 where v like 'a %'; ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where v='a '; ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where v like 'a%'; ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where v between 'a' and 'a '; ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; ---replace_column 9 # 10 # +--replace_column 10 # 11 # explain select * from t1 where v='a'; # GROUP BY @@ -151,15 +151,15 @@ select count(*) from t1 where v between 'a' and 'a '; select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; select count(*) from t1 where v like 'a%'; select count(*) from t1 where v like 'a %'; ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where v='a '; ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where v like 'a%'; ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where v between 'a' and 'a '; ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; ---replace_column 9 # 10 # +--replace_column 10 # 11 # explain select * from t1 where v='a'; # GROUP BY diff --git a/mysql-test/main/analyze_format_json.result b/mysql-test/main/analyze_format_json.result index 6c9b8ce2982..bc1bb7a1cb2 100644 --- a/mysql-test/main/analyze_format_json.result +++ b/mysql-test/main/analyze_format_json.result @@ -31,9 +31,9 @@ create table t1 (a int, b int, c int, key(a)); insert into t1 select A.a*10 + B.a, A.a*10 + B.a, A.a*10 + B.a from t0 A, t0 B; analyze select * from t0, t1 where t1.a=t0.a and t0.a > 9; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 0.00 Using where -1 SIMPLE t1 ref a a 5 test.t0.a 1 NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 0.00 Using where +1 SIMPLE t1 NULL ref a a 5 test.t0.a 1 NULL 100.00 NULL analyze format=json select * from t0, t1 where t1.a=t0.a and t0.a > 9; ANALYZE @@ -78,9 +78,9 @@ ANALYZE } analyze select * from t0, t1 where t1.a=t0.a and t1.b<4; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where -1 SIMPLE t1 ref a a 5 test.t0.a 1 1.00 100.00 40.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where +1 SIMPLE t1 NULL ref a a 5 test.t0.a 1 1.00 100.00 40.00 Using where analyze format=json select * from t0, t1 where t1.a=t0.a and t1.b<4; ANALYZE @@ -128,9 +128,9 @@ ANALYZE } analyze select * from t1 tbl1, t1 tbl2 where tbl1.b<2 and tbl2.b>5; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE tbl1 ALL NULL NULL NULL NULL 100 100.00 100.00 2.00 Using where -1 SIMPLE tbl2 ALL NULL NULL NULL NULL 100 100.00 100.00 94.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE tbl1 NULL ALL NULL NULL NULL NULL 100 100.00 100.00 2.00 Using where +1 SIMPLE tbl2 NULL ALL NULL NULL NULL NULL 100 100.00 100.00 94.00 Using where; Using join buffer (flat, BNL join) analyze format=json select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60; ANALYZE diff --git a/mysql-test/main/analyze_stmt.result b/mysql-test/main/analyze_stmt.result index c5d35759c9c..5d6ae89efcd 100644 --- a/mysql-test/main/analyze_stmt.result +++ b/mysql-test/main/analyze_stmt.result @@ -6,18 +6,18 @@ create table t1 (a int) engine=myisam; INSERT INTO t1 select * from t0; # Try a few basic selects to see that r_rows and r_filtered columns work analyze select * from t1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 analyze select * from t1 where a<5; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where analyze select * from t1 where a>100; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 0.00 Using where # ANALYZE DELETE will delete rows: analyze delete from t1 where a in (2,3,4); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where select * from t1; a 0 @@ -32,8 +32,8 @@ drop table t1; create table t1(a int, b int); insert into t1 select a,a from t0; analyze update t1 set b=100+b where a in (6,7,8); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where select * from t1; a b 0 0 @@ -51,15 +51,15 @@ drop table t1; create table t1(a int, b int); insert into t1 select a,a from t0; analyze (select * from t1 A where a<5) union (select * from t1 B where a in (5,6)); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where -2 UNION B ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 7.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where +2 UNION B NULL ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL 7.00 NULL NULL analyze (select * from t1 A where a<5) union (select * from t1 B where a in (1,2)); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where -2 UNION B ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 5.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where +2 UNION B NULL ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL 5.00 NULL NULL drop table t1; drop table t0; # @@ -72,14 +72,14 @@ create table t1 (a int, b int); insert into t1 values (1,1),(2,2),(3,3); # See .test file for the right values of r_rows and r_filtered. analyze select a, a in (select t0.b from t0 where t0.b+1=t1.b+1) from t1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 3.00 100.00 33.33 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 3.00 100.00 33.33 Using where # Try a subquery that is never executed analyze select a, a in (select t0.b from t0 where t0.b+1=t1.b+1) from t1 where t1.a > 5; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 3.00 100.00 0.00 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 0.00 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where drop table t0, t1; # # Tests for join buffering @@ -90,32 +90,32 @@ insert into t0 values create table t1 like t0; insert into t1 select * from t0; explain select * from t0, t1 where t0.a<5 and t1.a<5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) # These should have filtered=50 analyze select * from t0, t1 where t0.a<5 and t1.a<5; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where; Using join buffer (flat, BNL join) explain select * from t0, t1 where t0.a<5 and t1.b=t0.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) # Now, t1 should have filtered=10 analyze select * from t0, t1 where t0.a<5 and t1.b=t0.b; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where; Using join buffer (flat, BNL join) explain select * from t0, t1 where t0.a<5 and t1.a<5 and t1.b=t0.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) # Now, t1 should have filtered=10 analyze select * from t0, t1 where t0.a<5 and t1.a<5 and t1.b=t0.b; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 50.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where; Using join buffer (flat, BNL join) # TODO: Check what is counted for "range checked for each record". # # Test for joins @@ -127,14 +127,14 @@ A.a + 10 *B.a +100 * C.a from t0 A, t0 B, t0 C; # This always has matches, filtered=100%. analyze select * from t1,t2 where t2.key1=t1.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where -1 SIMPLE t2 ref key1 key1 5 test.t1.a 1 1.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where +1 SIMPLE t2 NULL ref key1 key1 5 test.t1.a 1 1.00 100.00 100.00 # This shows r_rows=0. It is actually 0.5 (should r_rows be changed to double?) analyze select * from t1,t2 where t2.key2x=t1.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where -1 SIMPLE t2 ref key2x key2x 5 test.t1.a 1 0.50 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where +1 SIMPLE t2 NULL ref key2x key2x 5 test.t1.a 1 0.50 100.00 100.00 select * from t1,t2 where t2.key2x=t1.a; a b key1 key2x col1 0 0 0 0 0 @@ -144,9 +144,9 @@ a b key1 key2x col1 8 8 4 8 4 # This has t2.filtered=40% (there are 5 values: {0,1,2,3,4}. two of them have mod=0) analyze select * from t1,t2 where t2.key2x=t1.a and mod(t2.col1,4)=0; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where -1 SIMPLE t2 ref key2x key2x 5 test.t1.a 1 0.50 100.00 40.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where +1 SIMPLE t2 NULL ref key2x key2x 5 test.t1.a 1 0.50 100.00 40.00 Using where drop table t0,t1,t2; # # Check non-merged derived tables @@ -156,9 +156,9 @@ insert into t0 values (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); update t0 set b=b/3; analyze select * from (select count(*),max(a),b from t0 group by b) T; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 10 4.00 100.00 100.00 -2 DERIVED t0 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 10 4.00 100.00 100.00 +2 DERIVED t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using temporary; Using filesort drop table t0; # # Check ORDER/GROUP BY @@ -167,8 +167,8 @@ create table t0 (a int, b int); insert into t0 values (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); analyze select count(*),max(a),b from t0 where a<7 group by b; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 70.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 70.00 Using where; Using temporary; Using filesort drop table t0; # # Check multi-table UPDATE/DELETE. @@ -178,22 +178,22 @@ create table t1 (a int, b int); insert into t0 values (0,0),(2,2),(4,4), (8,8); insert into t1 values (0,0),(2,2), (6,6); analyze select * from t0,t1 where t0.a=t1.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t0 ALL NULL NULL NULL NULL 4 4.00 100.00 16.67 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 16.67 Using where; Using join buffer (flat, BNL join) analyze update t0,t1 set t1.b=5555 where t0.a=t1.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t0 ALL NULL NULL NULL NULL 4 4.00 100.00 16.67 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 16.67 Using where select * from t1; a b 0 5555 2 5555 6 6 analyze delete t1 from t1, t0 where t0.a=t1.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t0 ALL NULL NULL NULL NULL 4 4.00 100.00 16.67 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 16.67 Using where select * from t1; a b 6 6 @@ -222,17 +222,17 @@ drop table t1, t2; create table t1 (a int, b int, key(a)); insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5); analyze delete from t1 where 1 > 2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE analyze delete from t1 where a > 30 and a < 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE analyze update t1 set b=12345 where 1 > 2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE analyze update t1 set b=12345 where a > 30 and a < 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE drop table t1; # # MDEV-6398: ANALYZE UPDATE does not populate r_rows @@ -240,8 +240,8 @@ drop table t1; create table t1 (i int); insert into t1 values (1),(2),(3),(4); analyze update t1 set i=8; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 drop table t1; # # Check ANALYZE SELECT INTO @@ -249,30 +249,30 @@ drop table t1; create table t1 (i int); insert into t1 values (1); analyze select * into @var from t1 ; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 NULL 100.00 NULL drop table t1; # # MDEV-6394: ANALYZE DELETE .. RETURNING fails with ERROR 2027 Malformed packet # create table t1 (i int); analyze delete from t1 returning *; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 0.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 0 0.00 100.00 100.00 drop table t1; # # MDEV-6396: ANALYZE INSERT/REPLACE is accepted, but does not produce a plan # create table t1 (a int primary key, b int); analyze insert into t1 values (1,1); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL select * from t1; a b 1 1 analyze replace t1 values (1,2); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL select * from t1; a b 1 2 @@ -283,16 +283,16 @@ drop table t1; create table t1(a int); insert into t1 values (1),(2); analyze select a into @var from t1 where a <2 ; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 100.00 50.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 2.00 100.00 50.00 Using where analyze select a into @var from t1 ; ERROR 42000: Result consisted of more than one row analyze insert into t1 select * from t1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 100.00 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 2.00 100.00 100.00 Using temporary analyze select * into outfile '../../tmp/data1.tmp' from t1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 drop table t1; # # MDEV-7024: Assertion `! is_set()' failed in @@ -301,8 +301,8 @@ drop table t1; create table t1(a int); prepare stmt from "analyze select * from t1"; execute stmt; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table drop table t1; # # MDEV-7674: ANALYZE shows r_rows=0 @@ -312,9 +312,9 @@ insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t2 (a int, key(a)); insert into t2 values (0),(1); analyze select * from t1 straight_join t2 force index(a) where t2.a=t1.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where -1 SIMPLE t2 ref a a 5 test.t1.a 2 0.20 100.00 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using where +1 SIMPLE t2 NULL ref a a 5 test.t1.a 2 0.20 100.00 100.00 Using index drop table t1,t2; # # MDEV-8063: Unconditional ANALYZE DELETE does not delete rows @@ -322,14 +322,14 @@ drop table t1,t2; create table t1 (i int); insert into t1 values (1),(2); analyze delete from t1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL 2 NULL NULL NULL Deleting all rows +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 2 NULL NULL NULL Deleting all rows select * from t1; i insert into t1 values (1),(2); explain delete from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL 2 Deleting all rows +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 2 Deleting all rows select * from t1; i 1 diff --git a/mysql-test/main/analyze_stmt_orderby.result b/mysql-test/main/analyze_stmt_orderby.result index d4d0fe6b25b..cfa1725c27c 100644 --- a/mysql-test/main/analyze_stmt_orderby.result +++ b/mysql-test/main/analyze_stmt_orderby.result @@ -13,8 +13,8 @@ insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B; # explain update t2 set b=b+1 order by b limit 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 10000 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10000 Using filesort explain format=json update t2 set b=b+1 order by b limit 5; EXPLAIN @@ -62,8 +62,8 @@ ANALYZE # explain update t2 set a=a+1 where a<10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 5 NULL 9 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 5 NULL 9 Using where; Using buffer explain format=json update t2 set a=a+1 where a<10; EXPLAIN @@ -115,8 +115,8 @@ ANALYZE # explain delete from t2 order by b limit 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 10000 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10000 Using filesort explain format=json delete from t2 order by b limit 5; EXPLAIN @@ -164,9 +164,9 @@ ANALYZE # explain select * from t0,t2 where t2.a=t0.a order by t2.b limit 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where; Using temporary; Using filesort -1 SIMPLE t2 ref a a 5 test.t0.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where; Using temporary; Using filesort +1 SIMPLE t2 NULL ref a a 5 test.t0.a 1 explain format=json select * from t0,t2 where t2.a=t0.a order by t2.b limit 4; EXPLAIN @@ -264,9 +264,9 @@ ANALYZE # explain select * from t0,t2 where t2.a=t0.a order by t0.a limit 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where; Using filesort -1 SIMPLE t2 ref a a 5 test.t0.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where; Using filesort +1 SIMPLE t2 NULL ref a a 5 test.t0.a 1 explain format=json select * from t0,t2 where t2.a=t0.a order by t0.a limit 4; EXPLAIN @@ -418,14 +418,14 @@ delete from t3 order by a; # EXPLAIN thinks it will use delete_all_rows(): explain delete from t3 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL 1 Deleting all rows +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 1 Deleting all rows # ANALYZE shows that delete_all_rows() didn't work and we deleted rows # one-by-one: analyze delete from t3 order by a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 1 0.00 100.00 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 0.00 100.00 100.00 Using filesort drop table t3; # # A test for duplicate_removal() @@ -625,12 +625,12 @@ INSERT INTO t2(col1, col2) VALUES flush status; explain select col1 f1, col2 f2, col1 f3 from t2 group by f1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx 5 NULL 7 Using index for group-by analyze select col1 f1, col2 f2, col1 f3 from t2 group by f1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 range NULL idx 5 NULL 7 20.00 100.00 100.00 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL range NULL idx 5 NULL 7 20.00 100.00 100.00 Using index for group-by analyze format=json select col1 f1, col2 f2, col1 f3 from t2 group by f1; ANALYZE diff --git a/mysql-test/main/analyze_stmt_privileges2.result b/mysql-test/main/analyze_stmt_privileges2.result index f269aaf540b..0d3d51f0cb2 100644 --- a/mysql-test/main/analyze_stmt_privileges2.result +++ b/mysql-test/main/analyze_stmt_privileges2.result @@ -355,11 +355,11 @@ a b 10 NULL 10 NULL EXPLAIN SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 ANALYZE SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 SELECT * FROM t1 WHERE a = 10; a b 10 NULL @@ -367,245 +367,245 @@ a b 10 NULL 10 NULL EXPLAIN SELECT * FROM t1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where ANALYZE SELECT * FROM t1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using where SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); a b EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 0.00 100.00 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 0.00 100.00 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 #------------------------------------------------------------------------ # I/R/U/D/S on the inner view # Expectation: Can run everything #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); EXPLAIN INSERT INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE INSERT INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO v1 SELECT * FROM t2; EXPLAIN INSERT INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE INSERT INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 REPLACE INTO v1 (a) VALUES (10); EXPLAIN REPLACE INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE REPLACE INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL REPLACE INTO v1 SELECT * FROM t2; EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE REPLACE INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 UPDATE v1 SET a = 10; EXPLAIN UPDATE v1 SET a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where ANALYZE UPDATE v1 SET a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where UPDATE v1 SET a = a + 1; EXPLAIN UPDATE v1 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where ANALYZE UPDATE v1 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 20.00 100.00 0.00 Using where DELETE FROM v1; EXPLAIN DELETE FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE DELETE FROM v1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where DELETE FROM v1 WHERE a = 10; EXPLAIN DELETE FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE DELETE FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where DELETE FROM v1 USING v1, t2; EXPLAIN DELETE FROM v1 USING v1, t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE DELETE FROM v1 USING v1, t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where SELECT * FROM v1; a b EXPLAIN SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where SELECT * FROM v1 WHERE a = 10; a b EXPLAIN SELECT * FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE SELECT * FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); a b EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 NULL 100.00 NULL #------------------------------------------------------------------------ # I/R/U/D/S on the outer view # Expectation: Can run everything #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); EXPLAIN INSERT INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE INSERT INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO v2 SELECT * FROM t2; EXPLAIN INSERT INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE INSERT INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 REPLACE INTO v2 (a) VALUES (10); EXPLAIN REPLACE INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE REPLACE INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL REPLACE INTO v2 SELECT * FROM t2; EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE REPLACE INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 UPDATE v2 SET a = 10; EXPLAIN UPDATE v2 SET a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 Using where ANALYZE UPDATE v2 SET a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24 24.00 100.00 50.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 24.00 100.00 50.00 Using where UPDATE v2 SET a = a + 1; EXPLAIN UPDATE v2 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 Using where ANALYZE UPDATE v2 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24 24.00 100.00 50.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 24.00 100.00 50.00 Using where UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 24 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 Using where ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 24 24.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 24.00 100.00 0.00 Using where DELETE FROM v2; EXPLAIN DELETE FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 Using where ANALYZE DELETE FROM v2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where DELETE FROM v2 WHERE a = 10; EXPLAIN DELETE FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 Using where ANALYZE DELETE FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where DELETE FROM v2 USING v2, t2; ANALYZE DELETE FROM v2 USING v2, t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 Using where ANALYZE SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a = 10; a b EXPLAIN SELECT * FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 Using where ANALYZE SELECT * FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); a b EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 12 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 12 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 12 12.00 100.00 0.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 NULL 100.00 NULL #======================================================================== # Test: Grant INSERT on the table @@ -621,18 +621,18 @@ connection con1; #------------------------------------------------------------------------ INSERT INTO t1 (a) VALUES (10); EXPLAIN INSERT INTO t1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE INSERT INTO t1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO t1 SELECT * FROM t2; EXPLAIN INSERT INTO t1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE INSERT INTO t1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 REPLACE INTO t1 (a) VALUES (10); ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 't1' EXPLAIN REPLACE INTO t1 (a) VALUES (10); @@ -904,11 +904,11 @@ ANALYZE REPLACE INTO t1 SELECT * FROM t2; ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 't1' UPDATE t1 SET a = 10; EXPLAIN UPDATE t1 SET a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 18 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 ANALYZE UPDATE t1 SET a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 18 18.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 18.00 100.00 100.00 UPDATE t1 SET a = a + 1; ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1' EXPLAIN UPDATE t1 SET a = a + 1; @@ -1181,11 +1181,11 @@ ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' DELETE FROM t1; EXPLAIN DELETE FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL 0 Deleting all rows +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 0 Deleting all rows ANALYZE DELETE FROM t1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL 0 NULL NULL NULL Deleting all rows +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 0 NULL NULL NULL Deleting all rows DELETE FROM t1 WHERE a = 10; ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 't1' EXPLAIN DELETE FROM t1 WHERE a = 10; @@ -1437,33 +1437,33 @@ ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; ERROR 42000: UPDATE command denied to user 'privtest'@'localhost' for table 't1' DELETE FROM t1; EXPLAIN DELETE FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL 0 Deleting all rows +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 0 Deleting all rows ANALYZE DELETE FROM t1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL 0 NULL NULL NULL Deleting all rows +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 0 NULL NULL NULL Deleting all rows DELETE FROM t1 WHERE a = 10; EXPLAIN DELETE FROM t1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 Using where ANALYZE DELETE FROM t1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 0.00 100.00 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 0.00 100.00 100.00 Using where DELETE FROM t1 USING t1, t2; EXPLAIN DELETE FROM t1 USING t1, t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE DELETE FROM t1 USING t1, t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1; ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' EXPLAIN SELECT * FROM t1; @@ -1490,115 +1490,115 @@ ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 't1' #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); EXPLAIN INSERT INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE INSERT INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO v1 SELECT * FROM t2; EXPLAIN INSERT INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE INSERT INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 REPLACE INTO v1 (a) VALUES (10); EXPLAIN REPLACE INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE REPLACE INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL REPLACE INTO v1 SELECT * FROM t2; EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE REPLACE INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 UPDATE v1 SET a = 10; EXPLAIN UPDATE v1 SET a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 Using where ANALYZE UPDATE v1 SET a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 16.00 100.00 75.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 16.00 100.00 75.00 Using where UPDATE v1 SET a = a + 1; EXPLAIN UPDATE v1 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 Using where ANALYZE UPDATE v1 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 16.00 100.00 75.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 16.00 100.00 75.00 Using where UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 Using where ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 16.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 16.00 100.00 0.00 Using where DELETE FROM v1; EXPLAIN DELETE FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where ANALYZE DELETE FROM v1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where DELETE FROM v1 WHERE a = 10; EXPLAIN DELETE FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where ANALYZE DELETE FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where DELETE FROM v1 USING v1, t2; EXPLAIN DELETE FROM v1 USING v1, t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where ANALYZE DELETE FROM v1 USING v1, t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where SELECT * FROM v1; a b EXPLAIN SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where ANALYZE SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where SELECT * FROM v1 WHERE a = 10; a b EXPLAIN SELECT * FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where ANALYZE SELECT * FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); a b EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 NULL 100.00 NULL #------------------------------------------------------------------------ # I/R/U/D/S on the outer view # Expectation: Can run everything: SELECT access to the column `a` @@ -1607,115 +1607,115 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); EXPLAIN INSERT INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE INSERT INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO v2 SELECT * FROM t2; EXPLAIN INSERT INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE INSERT INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 REPLACE INTO v2 (a) VALUES (10); EXPLAIN REPLACE INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE REPLACE INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL REPLACE INTO v2 SELECT * FROM t2; EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE REPLACE INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 UPDATE v2 SET a = 10; EXPLAIN UPDATE v2 SET a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where ANALYZE UPDATE v2 SET a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where UPDATE v2 SET a = a + 1; EXPLAIN UPDATE v2 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where ANALYZE UPDATE v2 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 20.00 100.00 0.00 Using where DELETE FROM v2; EXPLAIN DELETE FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE DELETE FROM v2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where DELETE FROM v2 WHERE a = 10; EXPLAIN DELETE FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE DELETE FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where DELETE FROM v2 USING v2, t2; EXPLAIN DELETE FROM v2 USING v2, t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE DELETE FROM v2 USING v2, t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a = 10; a b EXPLAIN SELECT * FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE SELECT * FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); a b EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 NULL 100.00 NULL #======================================================================== # Test: Grant SELECT, INSERT, UPDATE, DELETE on the table @@ -1731,223 +1731,223 @@ connection con1; #------------------------------------------------------------------------ INSERT INTO t1 (a) VALUES (10); EXPLAIN INSERT INTO t1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE INSERT INTO t1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO t1 SELECT * FROM t2; EXPLAIN INSERT INTO t1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE INSERT INTO t1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 REPLACE INTO t1 (a) VALUES (10); EXPLAIN REPLACE INTO t1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE REPLACE INTO t1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL REPLACE INTO t1 SELECT * FROM t2; EXPLAIN REPLACE INTO t1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE REPLACE INTO t1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 UPDATE t1 SET a = 10; EXPLAIN UPDATE t1 SET a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 ANALYZE UPDATE t1 SET a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24 24.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 24.00 100.00 100.00 UPDATE t1 SET a = a + 1; EXPLAIN UPDATE t1 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 ANALYZE UPDATE t1 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24 24.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 24.00 100.00 100.00 UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 24 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 Using where ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 24 24.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 24.00 100.00 0.00 Using where DELETE FROM t1; EXPLAIN DELETE FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL 0 Deleting all rows +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 0 Deleting all rows ANALYZE DELETE FROM t1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL 0 NULL NULL NULL Deleting all rows +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 0 NULL NULL NULL Deleting all rows DELETE FROM t1 WHERE a = 10; EXPLAIN DELETE FROM t1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 Using where ANALYZE DELETE FROM t1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 0.00 100.00 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 0.00 100.00 100.00 Using where DELETE FROM t1 USING t1, t2; EXPLAIN DELETE FROM t1 USING t1, t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE DELETE FROM t1 USING t1, t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1; a b EXPLAIN SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found ANALYZE SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1 WHERE a = 10; a b EXPLAIN SELECT * FROM t1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables ANALYZE SELECT * FROM t1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); a b EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table #------------------------------------------------------------------------ # I/R/U/D/S on the inner view # Expectation: Can run everything #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); EXPLAIN INSERT INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE INSERT INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO v1 SELECT * FROM t2; EXPLAIN INSERT INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE INSERT INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 REPLACE INTO v1 (a) VALUES (10); EXPLAIN REPLACE INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE REPLACE INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL REPLACE INTO v1 SELECT * FROM t2; EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE REPLACE INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 UPDATE v1 SET a = 10; EXPLAIN UPDATE v1 SET a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 Using where ANALYZE UPDATE v1 SET a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 16.00 100.00 75.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 16.00 100.00 75.00 Using where UPDATE v1 SET a = a + 1; EXPLAIN UPDATE v1 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 Using where ANALYZE UPDATE v1 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 16.00 100.00 75.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 16.00 100.00 75.00 Using where UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 Using where ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 16.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 16.00 100.00 0.00 Using where DELETE FROM v1; EXPLAIN DELETE FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where ANALYZE DELETE FROM v1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where DELETE FROM v1 WHERE a = 10; EXPLAIN DELETE FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where ANALYZE DELETE FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where DELETE FROM v1 USING v1, t2; EXPLAIN DELETE FROM v1 USING v1, t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where ANALYZE DELETE FROM v1 USING v1, t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where SELECT * FROM v1; a b EXPLAIN SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where ANALYZE SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where SELECT * FROM v1 WHERE a = 10; a b EXPLAIN SELECT * FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where ANALYZE SELECT * FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); a b EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 4.00 100.00 0.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 NULL 100.00 NULL #------------------------------------------------------------------------ # I/R/U/D/S on the outer view # Expectation: Can run everything @@ -1955,107 +1955,107 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f # Note: some queries are commented due to MDEV-7034 INSERT INTO v2 (a) VALUES (10); EXPLAIN INSERT INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE INSERT INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO v2 SELECT * FROM t2; EXPLAIN INSERT INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE INSERT INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 REPLACE INTO v2 (a) VALUES (10); EXPLAIN REPLACE INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE REPLACE INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL REPLACE INTO v2 SELECT * FROM t2; EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE REPLACE INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 UPDATE v2 SET a = 10; EXPLAIN UPDATE v2 SET a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where ANALYZE UPDATE v2 SET a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where UPDATE v2 SET a = a + 1; EXPLAIN UPDATE v2 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where ANALYZE UPDATE v2 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 20.00 100.00 60.00 Using where UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 20.00 100.00 0.00 Using where DELETE FROM v2; EXPLAIN DELETE FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE DELETE FROM v2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where DELETE FROM v2 WHERE a = 10; EXPLAIN DELETE FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE DELETE FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where DELETE FROM v2 USING v2, t2; ANALYZE DELETE FROM v2 USING v2, t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a = 10; a b EXPLAIN SELECT * FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where ANALYZE SELECT * FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); a b EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 8.00 100.00 0.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 NULL 100.00 NULL ######################################################################### # Inner view permission tests @@ -2680,138 +2680,138 @@ ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v1' SELECT * FROM v1; a b EXPLAIN SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 14 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 14 Using where ANALYZE SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 14 14.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 14 14.00 100.00 0.00 Using where SELECT * FROM v1 WHERE a = 10; a b EXPLAIN SELECT * FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 14 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 14 Using where ANALYZE SELECT * FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 14 14.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 14 14.00 100.00 0.00 Using where SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); a b EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 14 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 14 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 14 14.00 100.00 0.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 14 14.00 100.00 0.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 NULL 100.00 NULL #------------------------------------------------------------------------ # I/R/U/D/S on the outer view # Expectation: Can run everything #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); EXPLAIN INSERT INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE INSERT INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO v2 SELECT * FROM t2; EXPLAIN INSERT INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE INSERT INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 REPLACE INTO v2 (a) VALUES (10); EXPLAIN REPLACE INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE REPLACE INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL REPLACE INTO v2 SELECT * FROM t2; EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE REPLACE INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 UPDATE v2 SET a = 10; EXPLAIN UPDATE v2 SET a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 30 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 30 Using where ANALYZE UPDATE v2 SET a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 30 30.00 100.00 40.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 30 30.00 100.00 40.00 Using where UPDATE v2 SET a = a + 1; EXPLAIN UPDATE v2 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 30 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 30 Using where ANALYZE UPDATE v2 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 30 30.00 100.00 40.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 30 30.00 100.00 40.00 Using where UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 30 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 30 Using where ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 30 30.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 30 30.00 100.00 0.00 Using where DELETE FROM v2; EXPLAIN DELETE FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 18 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 Using where ANALYZE DELETE FROM v2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where DELETE FROM v2 WHERE a = 10; EXPLAIN DELETE FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 18 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 Using where ANALYZE DELETE FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where DELETE FROM v2 USING v2, t2; ANALYZE DELETE FROM v2 USING v2, t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 18 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 Using where ANALYZE SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a = 10; a b EXPLAIN SELECT * FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 18 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 Using where ANALYZE SELECT * FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); a b EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 18 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 18 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 18 18.00 100.00 0.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 NULL 100.00 NULL #======================================================================== # Test: Grant INSERT on the inner view @@ -3751,11 +3751,11 @@ ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v1' DELETE FROM v1; EXPLAIN DELETE FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 29 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 29 Using where ANALYZE DELETE FROM v1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 29 29.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 29 29.00 100.00 0.00 Using where DELETE FROM v1 WHERE a = 10; ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 'v1' EXPLAIN DELETE FROM v1 WHERE a = 10; @@ -3886,222 +3886,222 @@ connection con1; #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); EXPLAIN INSERT INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE INSERT INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO v1 SELECT * FROM t2; EXPLAIN INSERT INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE INSERT INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 REPLACE INTO v1 (a) VALUES (10); EXPLAIN REPLACE INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE REPLACE INTO v1 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL REPLACE INTO v1 SELECT * FROM t2; EXPLAIN REPLACE INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE REPLACE INTO v1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 UPDATE v1 SET a = 10; EXPLAIN UPDATE v1 SET a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 47 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 47 Using where ANALYZE UPDATE v1 SET a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 47 47.00 100.00 25.53 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 47 47.00 100.00 25.53 Using where UPDATE v1 SET a = a + 1; EXPLAIN UPDATE v1 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 47 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 47 Using where ANALYZE UPDATE v1 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 47 47.00 100.00 25.53 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 47 47.00 100.00 25.53 Using where UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 47 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 47 Using where ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 47 47.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 47 47.00 100.00 0.00 Using where DELETE FROM v1; EXPLAIN DELETE FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 Using where ANALYZE DELETE FROM v1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where DELETE FROM v1 WHERE a = 10; EXPLAIN DELETE FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 Using where ANALYZE DELETE FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where DELETE FROM v1 USING v1, t2; EXPLAIN DELETE FROM v1 USING v1, t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 Using where ANALYZE DELETE FROM v1 USING v1, t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 Using where ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where SELECT * FROM v1; a b EXPLAIN SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 Using where ANALYZE SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where SELECT * FROM v1 WHERE a = 10; a b EXPLAIN SELECT * FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 Using where ANALYZE SELECT * FROM v1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); a b EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 35 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 35 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 35 35.00 100.00 0.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 NULL 100.00 NULL #------------------------------------------------------------------------ # I/R/U/D/S on the outer view # Expectation: Can run everything #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); EXPLAIN INSERT INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE INSERT INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO v2 SELECT * FROM t2; EXPLAIN INSERT INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE INSERT INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 REPLACE INTO v2 (a) VALUES (10); EXPLAIN REPLACE INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE REPLACE INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL REPLACE INTO v2 SELECT * FROM t2; EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE REPLACE INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 UPDATE v2 SET a = 10; EXPLAIN UPDATE v2 SET a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 51 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 51 Using where ANALYZE UPDATE v2 SET a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 51 51.00 100.00 23.53 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 51 51.00 100.00 23.53 Using where UPDATE v2 SET a = a + 1; EXPLAIN UPDATE v2 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 51 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 51 Using where ANALYZE UPDATE v2 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 51 51.00 100.00 23.53 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 51 51.00 100.00 23.53 Using where UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 51 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 51 Using where ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 51 51.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 51 51.00 100.00 0.00 Using where DELETE FROM v2; EXPLAIN DELETE FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 Using where ANALYZE DELETE FROM v2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where DELETE FROM v2 WHERE a = 10; EXPLAIN DELETE FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 Using where ANALYZE DELETE FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where DELETE FROM v2 USING v2, t2; ANALYZE DELETE FROM v2 USING v2, t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 Using where ANALYZE SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a = 10; a b EXPLAIN SELECT * FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 Using where ANALYZE SELECT * FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); a b EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 39 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 39 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 NULL 100.00 NULL ######################################################################### # Outer view permission tests @@ -4385,11 +4385,11 @@ ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' SELECT a FROM v2; a EXPLAIN SELECT a FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 Using where ANALYZE SELECT a FROM v2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where SELECT * FROM v2; ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' EXPLAIN SELECT * FROM v2; @@ -4405,11 +4405,11 @@ ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' SELECT a FROM v2 WHERE a = 10; a EXPLAIN SELECT a FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 Using where ANALYZE SELECT a FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for table 'v2' EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); @@ -4597,31 +4597,31 @@ ERROR 42000: DELETE command denied to user 'privtest'@'localhost' for table 'v2' SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 Using where ANALYZE SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a = 10; a b EXPLAIN SELECT * FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 Using where ANALYZE SELECT * FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); a b EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 39 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 39 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 39 39.00 100.00 0.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 NULL 100.00 NULL #======================================================================== # Test: Grant INSERT on the outer view @@ -4859,18 +4859,18 @@ ANALYZE REPLACE INTO v2 SELECT * FROM t2; ERROR 42000: INSERT, DELETE command denied to user 'privtest'@'localhost' for table 'v2' UPDATE v2 SET a = 10; EXPLAIN UPDATE v2 SET a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 43 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 43 Using where ANALYZE UPDATE v2 SET a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 43 43.00 100.00 6.98 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 43 43.00 100.00 6.98 Using where UPDATE v2 SET a = a + 1; EXPLAIN UPDATE v2 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 43 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 43 Using where ANALYZE UPDATE v2 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 43 43.00 100.00 6.98 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 43 43.00 100.00 6.98 Using where UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; ERROR 42000: SELECT command denied to user 'privtest'@'localhost' for column 'a' in table 'v2' EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; @@ -5128,107 +5128,107 @@ connection con1; #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); EXPLAIN INSERT INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE INSERT INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO v2 SELECT * FROM t2; EXPLAIN INSERT INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE INSERT INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 REPLACE INTO v2 (a) VALUES (10); EXPLAIN REPLACE INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL ANALYZE REPLACE INTO v2 (a) VALUES (10); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL REPLACE INTO v2 SELECT * FROM t2; EXPLAIN REPLACE INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE REPLACE INTO v2 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 UPDATE v2 SET a = 10; EXPLAIN UPDATE v2 SET a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 56 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 56 Using where ANALYZE UPDATE v2 SET a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 56 56.00 100.00 21.43 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 56 56.00 100.00 21.43 Using where UPDATE v2 SET a = a + 1; EXPLAIN UPDATE v2 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 56 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 56 Using where ANALYZE UPDATE v2 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 56 56.00 100.00 21.43 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 56 56.00 100.00 21.43 Using where UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 56 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 56 Using where ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 56 56.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 56 56.00 100.00 0.00 Using where DELETE FROM v2; EXPLAIN DELETE FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 44 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 Using where ANALYZE DELETE FROM v2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where DELETE FROM v2 WHERE a = 10; EXPLAIN DELETE FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 44 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 Using where ANALYZE DELETE FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where DELETE FROM v2 USING v2, t2; ANALYZE DELETE FROM v2 USING v2, t2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 44 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 Using where ANALYZE SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a = 10; a b EXPLAIN SELECT * FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 44 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 Using where ANALYZE SELECT * FROM v2 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); a b EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 44 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 44 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 44 44.00 100.00 0.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 NULL 100.00 NULL +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 NULL 100.00 NULL disconnect con1; connection default; DROP USER 'privtest'@localhost; diff --git a/mysql-test/main/analyze_stmt_slow_query_log.result b/mysql-test/main/analyze_stmt_slow_query_log.result index a0c4b45dee0..8905b734bac 100644 --- a/mysql-test/main/analyze_stmt_slow_query_log.result +++ b/mysql-test/main/analyze_stmt_slow_query_log.result @@ -10,9 +10,9 @@ a 1 2 drop table t1; -# explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -# explain: 1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL -# explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -# explain: 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where -# explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -# explain: 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +# explain: id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +# explain: 1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +# explain: id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +# explain: 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +# explain: id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +# explain: 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/main/ansi.result b/mysql-test/main/ansi.result index 810168cc3bd..8fe9e17730a 100644 --- a/mysql-test/main/ansi.result +++ b/mysql-test/main/ansi.result @@ -57,13 +57,13 @@ SELECT -1||0<<1 AS a FROM DUAL; a 18446744073709551596 EXPLAIN EXTENDED SELECT -1<<1||1 AS a FROM DUAL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select -1 << concat(1,1) AS "a" EXPLAIN EXTENDED SELECT -1||0<<1 AS a FROM DUAL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select concat(-1,0) << 1 AS "a" SELECT -1+1||1 AS a FROM DUAL; @@ -73,13 +73,13 @@ SELECT -1||0+1 AS a FROM DUAL; a -9 EXPLAIN EXTENDED SELECT -1+1||1 AS a FROM DUAL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select -1 + concat(1,1) AS "a" EXPLAIN EXTENDED SELECT -1||0+1 AS a FROM DUAL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select concat(-1,0) + 1 AS "a" SELECT 1*1||-1 AS a FROM DUAL; @@ -91,13 +91,13 @@ SELECT 1||1*-1 AS a FROM DUAL; a -11 EXPLAIN EXTENDED SELECT 1*1||-1 AS a FROM DUAL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 1 * concat(1,-1) AS "a" EXPLAIN EXTENDED SELECT 1||1*-1 AS a FROM DUAL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select concat(1,1) * -1 AS "a" SELECT -1^1||1 AS a FROM DUAL; @@ -107,12 +107,12 @@ SELECT -1||0^1 AS a FROM DUAL; a 18446744073709551607 EXPLAIN EXTENDED SELECT -1^1||1 AS a FROM DUAL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select -1 ^ concat(1,1) AS "a" EXPLAIN EXTENDED SELECT -1||0^1 AS a FROM DUAL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select concat(-1,0) ^ 1 AS "a" diff --git a/mysql-test/main/aria_icp_debug.result b/mysql-test/main/aria_icp_debug.result index fc01ee4fb3b..be1a29ae408 100644 --- a/mysql-test/main/aria_icp_debug.result +++ b/mysql-test/main/aria_icp_debug.result @@ -17,8 +17,8 @@ engine Aria explain select * from t2 where kp1 between 10 and 20 and kp2 +1 >100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range kp1 kp1 5 NULL 10 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range kp1 kp1 5 NULL 10 Using index condition set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go'; select * from t2 where kp1 between 10 and 20 and kp2 +1 >100; connect con1, localhost, root,,; diff --git a/mysql-test/main/auto_increment.result b/mysql-test/main/auto_increment.result index bd61d73f08c..d4c4c98f3ae 100644 --- a/mysql-test/main/auto_increment.result +++ b/mysql-test/main/auto_increment.result @@ -140,8 +140,8 @@ select last_insert_id(); last_insert_id() 255 explain extended select last_insert_id(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select last_insert_id() AS `last_insert_id()` insert into t1 set i = 254; diff --git a/mysql-test/main/bench_count_distinct.result b/mysql-test/main/bench_count_distinct.result index 8b67e4be38a..5b81e079a58 100644 --- a/mysql-test/main/bench_count_distinct.result +++ b/mysql-test/main/bench_count_distinct.result @@ -4,8 +4,8 @@ select count(distinct n) from t1; count(distinct n) 100 explain extended select count(distinct n) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range NULL n 4 NULL 10 100.00 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL n 4 NULL 10 100.00 Using index for group-by Warnings: Note 1003 select count(distinct `test`.`t1`.`n`) AS `count(distinct n)` from `test`.`t1` drop table t1; diff --git a/mysql-test/main/binary.result b/mysql-test/main/binary.result index be87c25e932..b6fe5a06968 100644 --- a/mysql-test/main/binary.result +++ b/mysql-test/main/binary.result @@ -173,15 +173,15 @@ hex(a) 1F9480179366F2BF567E1C4B964C1EF029082020 1F9480179366F2BF567E1C4B964C1EF029087575 EXPLAIN SELECT hex(a) FROM t1 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx 20 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL idx 20 NULL 3 Using index SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020'); hex(a) 1F9480179366F2BF567E1C4B964C1EF029082020 EXPLAIN SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx idx 20 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx idx 20 const 1 Using where; Using index SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF02908'); hex(a) DROP TABLE t1; diff --git a/mysql-test/main/brackets.result b/mysql-test/main/brackets.result index 88707cfb5df..80fd46d7e9e 100644 --- a/mysql-test/main/brackets.result +++ b/mysql-test/main/brackets.result @@ -5,13 +5,13 @@ select 1 union ( select 2 union select 3); 3 explain extended select 1 union ( select 2 union select 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL -NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL +NULL UNION RESULT <union1,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 1 AS `1` union /* select#4 */ select `__4`.`2` AS `2` from (/* select#2 */ select 2 AS `2` union /* select#3 */ select 3 AS `3`) `__4` select 1 union ( select 1 union select 1); @@ -19,13 +19,13 @@ select 1 union ( select 1 union select 1); 1 explain extended select 1 union ( select 1 union select 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL -NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL +NULL UNION RESULT <union1,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 1 AS `1` union /* select#4 */ select `__4`.`1` AS `1` from (/* select#2 */ select 1 AS `1` union /* select#3 */ select 1 AS `1`) `__4` select 1 union all ( select 1 union select 1); @@ -34,12 +34,12 @@ select 1 union all ( select 1 union select 1); 1 explain extended select 1 union all ( select 1 union select 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 1 AS `1` union all /* select#4 */ select `__4`.`1` AS `1` from (/* select#2 */ select 1 AS `1` union /* select#3 */ select 1 AS `1`) `__4` select 1 union ( select 1 union all select 1); @@ -47,12 +47,12 @@ select 1 union ( select 1 union all select 1); 1 explain extended select 1 union ( select 1 union all select 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 1 AS `1` union /* select#4 */ select `__4`.`1` AS `1` from (/* select#2 */ select 1 AS `1` union /* select#3 */ select 1 AS `1`) `__4` select 1 union select 1 union all select 1; @@ -61,11 +61,11 @@ select 1 union select 1 union all select 1; 1 explain extended select 1 union select 1 union all select 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 1 AS `1` union /* select#2 */ select 1 AS `1` union all /* select#3 */ select 1 AS `1` (select 1 as a) union (select 2) order by a; @@ -74,10 +74,10 @@ a 2 explain extended (select 1 as a) union (select 2) order by a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 (/* select#1 */ select 1 AS `a`) union (/* select#2 */ select 2 AS `2`) order by `a` /* select#1 */ select 1 AS `a` union /* select#2 */ select 2 AS `2` order by `a`; @@ -86,10 +86,10 @@ a 2 explain extended /* select#1 */ select 1 AS `a` union /* select#2 */ select 2 AS `2` order by `a`; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 /* select#1 */ select 1 AS `a` union /* select#2 */ select 2 AS `2` order by `a` select 1 union ( select 1 union (select 1 union (select 1 union select 1))); @@ -97,19 +97,19 @@ select 1 union ( select 1 union (select 1 union (select 1 union select 1))); 1 explain extended all select 1 union ( select 1 union (select 1 union (select 1 union select 1))); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -8 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -7 UNION <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -6 UNION <derived4> ALL NULL NULL NULL NULL 2 100.00 -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -5 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL -NULL UNION RESULT <union3,6> ALL NULL NULL NULL NULL NULL NULL -NULL UNION RESULT <union2,7> ALL NULL NULL NULL NULL NULL NULL -NULL UNION RESULT <union1,8> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +8 UNION <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +7 UNION <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +6 UNION <derived4> NULL ALL NULL NULL NULL NULL 2 100.00 +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +5 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union4,5> NULL ALL NULL NULL NULL NULL NULL NULL +NULL UNION RESULT <union3,6> NULL ALL NULL NULL NULL NULL NULL NULL +NULL UNION RESULT <union2,7> NULL ALL NULL NULL NULL NULL NULL NULL +NULL UNION RESULT <union1,8> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1/0 Filter Select: select `1` AS `1` */ select 1 AS `1` union /* select#8/0 */ select `__8`.`1` AS `1` from (/* select#2/1 Filter Select: select `1` AS `1` */ select 1 AS `1` union /* select#7/1 */ select `__7`.`1` AS `1` from (/* select#3/2 Filter Select: select `1` AS `1` */ select 1 AS `1` union /* select#6/2 */ select `__6`.`1` AS `1` from (/* select#4/3 Filter Select: select `1` AS `1` */ select 1 AS `1` union /* select#5/3 */ select 1 AS `1`) `__6`) `__7`) `__8` # @@ -252,8 +252,8 @@ select a from t1 order by a desc limit 1; a 30 explain extended select a from t1 order by a desc limit 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` order by `test`.`t1`.`a` desc limit 1 explain format=json select a from t1 order by a desc limit 1; @@ -282,8 +282,8 @@ EXPLAIN a 30 explain extended (select a from t1 order by a desc) limit 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 (select `test`.`t1`.`a` AS `a` from `test`.`t1` order by `test`.`t1`.`a` desc limit 1) explain format=json (select a from t1 order by a desc) limit 1; @@ -312,10 +312,10 @@ EXPLAIN a 30 explain extended (select a from t1 where a=20 union select a from t1) order by a desc limit 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 UNION t1 ALL NULL NULL NULL NULL 3 100.00 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 UNION t1 NULL ALL NULL NULL NULL NULL 3 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 20 union /* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` order by `a` desc limit 1 explain format=json (select a from t1 where a=20 union select a from t1) order by a desc limit 1; @@ -366,10 +366,10 @@ EXPLAIN a 30 explain extended ((select a from t1 where a=20 union select a from t1) order by a desc) limit 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 UNION t1 ALL NULL NULL NULL NULL 3 100.00 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 UNION t1 NULL ALL NULL NULL NULL NULL 3 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 20 union /* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` order by `a` desc limit 1 explain format=json ((select a from t1 where a=20 union select a from t1) order by a desc) limit 1; @@ -428,10 +428,10 @@ pk 2 5 explain extended ((select * from t1 order by pk) limit 2) union (select * from t1 where pk > 4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using filesort -2 UNION t1 ALL NULL NULL NULL NULL 5 100.00 Using where -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using filesort +2 UNION t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` order by `test`.`t1`.`pk` limit 2) union (/* select#2 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where `test`.`t1`.`pk` > 4) explain format=json ((select * from t1 order by pk) limit 2) union (select * from t1 where pk > 4); diff --git a/mysql-test/main/case.result b/mysql-test/main/case.result index f4f02703c5e..92a36009167 100644 --- a/mysql-test/main/case.result +++ b/mysql-test/main/case.result @@ -24,8 +24,8 @@ select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END; CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END one explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select case 1 when 1 then 'one' when 2 then 'two' else 'more' end AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END` select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END; @@ -71,8 +71,8 @@ fcase count(*) 2 1 3 1 explain extended select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort Warnings: Note 1003 select case `test`.`t1`.`a` when 1 then 2 when 2 then 3 else 0 end AS `fcase`,count(0) AS `count(*)` from `test`.`t1` group by case `test`.`t1`.`a` when 1 then 2 when 2 then 3 else 0 end select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase; @@ -152,8 +152,8 @@ explain extended SELECT COALESCE(1), COALESCE(1.0),COALESCE('a'), COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'), COALESCE('a' COLLATE latin1_bin,'b'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce('a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,'1') AS `COALESCE(1,'1')`,coalesce(1.1,'1') AS `COALESCE(1.1,'1')`,coalesce('a' collate latin1_bin,'b') AS `COALESCE('a' COLLATE latin1_bin,'b')` SHOW CREATE TABLE t1; @@ -291,8 +291,8 @@ a # Multiple comparison types in CASE, not Ok to propagate EXPLAIN EXTENDED SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END AND a='5'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '5' and case `test`.`t1`.`a` when 1 then 1 else 0 end DROP TABLE t1; @@ -310,8 +310,8 @@ a # String comparison in CASE and in the equality, ok to propagate EXPLAIN EXTENDED SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' SELECT * FROM t1 WHERE a=3; @@ -328,8 +328,8 @@ a # This can change in the future. See MDEV-8748. EXPLAIN EXTENDED SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a=3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where case `test`.`t1`.`a` when 3 then 1 else 0 end and `test`.`t1`.`a` = 3 SELECT * FROM t1 WHERE a=3; @@ -344,8 +344,8 @@ a # String comparison in CASE, integer comparison in the equality, not Ok to propagate EXPLAIN EXTENDED SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END AND a=3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where case `test`.`t1`.`a` when '100' then 1 else 0 end and `test`.`t1`.`a` = 3 SELECT * FROM t1 WHERE a='100'; @@ -360,8 +360,8 @@ a # Integer comparison in CASE, string comparison in the equality, not Ok to propagate EXPLAIN EXTENDED SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a='100'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '100' and case `test`.`t1`.`a` when 3 then 1 else 0 end SELECT * FROM t1 WHERE a='100'; @@ -376,8 +376,8 @@ a # Multiple type comparison in CASE, string comparison in the equality, not Ok to propagate EXPLAIN EXTENDED SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a='100'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '100' and case `test`.`t1`.`a` when 3 then 1 when '100' then 1 else 0 end SELECT * FROM t1 WHERE a=3; @@ -392,8 +392,8 @@ a # Multiple type comparison in CASE, integer comparison in the equality, not Ok to propagate EXPLAIN EXTENDED SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a=3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where case `test`.`t1`.`a` when 3 then 1 when '100' then 1 else 0 end and `test`.`t1`.`a` = 3 DROP TABLE t1; @@ -504,44 +504,44 @@ SET NAMES latin1; CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); INSERT INTO t1 VALUES ('a'),('b'),('c'); EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE a WHEN 'a' THEN 'a' ELSE 'a' END='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN a THEN 'a' ELSE 'a' END='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN a ELSE 'a' END='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and case 'a' when 'a' then `test`.`t1`.`a` else 'a' end = 'a' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN 'a' ELSE a END='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and case 'a' when 'a' then 'a' else `test`.`t1`.`a` end = 'a' ALTER TABLE t1 MODIFY a VARBINARY(10); EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE a WHEN 'a' THEN 'a' ELSE 'a' END='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN a THEN 'a' ELSE 'a' END='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN a ELSE 'a' END='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN 'a' ELSE a END='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' DROP TABLE t1; @@ -567,8 +567,8 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE CASE a WHEN b THEN 1 END=1 AND CASE WHEN a THEN b ELSE 1 END=3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where case `test`.`t1`.`a` when `test`.`t1`.`b` then 1 end = 1 and case when `test`.`t1`.`a` then `test`.`t1`.`b` else 1 end = 3 DROP TABLE t1; diff --git a/mysql-test/main/cast.result b/mysql-test/main/cast.result index 4e518826017..b6ea88860bd 100644 --- a/mysql-test/main/cast.result +++ b/mysql-test/main/cast.result @@ -30,8 +30,8 @@ select ~5, cast(~5 as signed); ~5 cast(~5 as signed) 18446744073709551610 -6 explain extended select ~5, cast(~5 as signed); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select ~5 AS `~5`,cast(~5 as signed) AS `cast(~5 as signed)` select cast(18446744073709551615 as signed); @@ -336,18 +336,18 @@ select cast(cast(-1.1 as double) as datetime); cast(cast(-1.1 as double) as datetime) NULL explain extended select cast(10 as double(5,2)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select cast(10 as double(5,2)) AS `cast(10 as double(5,2))` explain extended select cast(10 as double); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select cast(10 as double) AS `cast(10 as double)` explain extended select cast(10 as decimal(5,2)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select cast(10 as decimal(5,2)) AS `cast(10 as decimal(5,2))` select cast('18446744073709551616' as unsigned); diff --git a/mysql-test/main/compare.result b/mysql-test/main/compare.result index c4650014326..ec197977214 100644 --- a/mysql-test/main/compare.result +++ b/mysql-test/main/compare.result @@ -2,8 +2,8 @@ drop table if exists t1; CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id)); insert into t1 values ('000000000001'),('000000000002'); explain select * from t1 where id=000000000001; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 12 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 12 NULL 2 Using where; Using index select * from t1 where id=000000000001; id 000000000001 @@ -61,8 +61,8 @@ CONCAT(b,c) CONCAT(b,c) = '0101' 0101 1 0202 0 EXPLAIN EXTENDED SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`b` = 1 and concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = '0101' SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101'; @@ -82,9 +82,9 @@ SELECT a, (SELECT COUNT(*) FROM t1 WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x FROM t2 ORDER BY a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using filesort -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using filesort +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 @@ -114,9 +114,9 @@ select * from t1 where a>="aaa"; a bb explain select * from t1 where a="aaa"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 3 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 3 const 1 Using where; Using index explain select * from t1 where a="aa "; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 3 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 3 const 1 Using where; Using index drop table t1; diff --git a/mysql-test/main/compress.result b/mysql-test/main/compress.result index 24979346149..47bbeadd011 100644 --- a/mysql-test/main/compress.result +++ b/mysql-test/main/compress.result @@ -134,20 +134,20 @@ fld3 select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%'; fld3 explain select t2.fld3 from t2 where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3,not_used); ERROR 42000: Key 'not_used' doesn't exist in table 't2' explain select fld3 from t2 use index (not_used); @@ -157,8 +157,8 @@ fld3 honeysuckle honoring explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld3 fld3 30 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 Using where; Using index select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3; fld1 fld3 148504 Colombo @@ -177,8 +177,8 @@ fld1 250501 250502 explain select fld1 from t2 where fld1=250501 or fld1="250502"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld1 fld1 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 Using where; Using index select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502; fld1 250501 @@ -186,8 +186,8 @@ fld1 250505 250601 explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 Using where; Using index select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; fld1 fld3 012001 flanking @@ -603,21 +603,21 @@ companynr rtrim(space(512+companynr)) select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3; fld3 explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort -1 SIMPLE t3 ref period period 4 test.t1.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index period period 4 NULL 1 -1 SIMPLE t1 ref period period 4 test.t3.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL index period period 4 NULL 1 +1 SIMPLE t1 NULL ref period period 4 test.t3.period 4181 explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index period period 4 NULL 1 -1 SIMPLE t3 ref period period 4 test.t1.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index period period 4 NULL 1 +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 select period from t1; period 9410 @@ -630,9 +630,9 @@ select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3. fld3 period breaking 1001 explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const fld1 fld1 4 const 1 -1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const fld1 fld1 4 const 1 +1 SIMPLE t3 NULL const PRIMARY,period PRIMARY 4 const 1 select fld3,period from t2,t1 where companynr*10 = 37*10; fld3 period breaking 9410 @@ -1366,82 +1366,82 @@ select count(*) from t2 left join t4 using (companynr) where t4.companynr is not count(*) 1199 explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 Using where; Not exists select companynr,companyname from t2 left join t4 using (companynr) where companynr is null; companynr companyname select count(*) from t2 left join t4 using (companynr) where companynr is not null; count(*) 1200 explain select companynr,companyname from t2 left join t4 using (companynr) where companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE delete from t2 where fld1=999999; explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where SET @@optimizer_switch=@local_optimizer_switch; select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; companynr companynr 37 36 41 40 explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL index NULL PRIMARY 1 NULL 12 Using index; Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join) SET @@join_cache_level=@local_join_cache_level; select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008; fld1 companynr fld3 period @@ -1515,8 +1515,8 @@ select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069 explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>""; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; @@ -1956,11 +1956,11 @@ select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = fld1 sum(price) 038008 234298 explain select fld3 from t2 where 1>2 or 2>3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select fld3 from t2 where fld1=fld1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502; companynr fld1 34 250501 @@ -2011,8 +2011,8 @@ select count(*) from t3 where companynr=512 and price2=76234234; count(*) 4181 explain select min(fld1),max(fld1),count(*) from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(fld1),max(fld1),count(*) from t2; min(fld1) max(fld1) count(*) 0 1232609 1199 diff --git a/mysql-test/main/create.result b/mysql-test/main/create.result index acef8b73074..2dbe79249bc 100644 --- a/mysql-test/main/create.result +++ b/mysql-test/main/create.result @@ -110,8 +110,8 @@ create table t1 (a int auto_increment not null primary key, B CHAR(20)); insert into t1 (b) values ("hello"),("my"),("world"); create table t2 (key (b)) select * from t1; explain select * from t2 where b="world"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref B B 21 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref B B 21 const 1 Using index condition select * from t2 where b="world"; a B 3 world diff --git a/mysql-test/main/cte_nonrecursive.result b/mysql-test/main/cte_nonrecursive.result index a84a804a20d..118f898e57a 100644 --- a/mysql-test/main/cte_nonrecursive.result +++ b/mysql-test/main/cte_nonrecursive.result @@ -22,15 +22,15 @@ c a explain with t as (select a from t1 where b >= 'c') select * from t2,t where t2.c=t.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) explain select * from t2, (select a from t1 where b >= 'c') as t where t2.c=t.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) # select '*' in the specification of t with t as (select * from t1 where b >= 'c') select * from t2,t where t2.c=t.a; @@ -47,15 +47,15 @@ c a b explain with t as (select * from t1 where b >= 'c') select * from t2,t where t2.c=t.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) explain select * from t2, (select * from t1 where b >= 'c') as t where t2.c=t.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) # rename fields returned by the specication when defining t with t(f1,f2) as (select * from t1 where b >= 'c') select * from t2,t where t2.c=t.f1; @@ -66,9 +66,9 @@ c f1 f2 explain with t(f1,f2) as (select * from t1 where b >= 'c') select * from t2,t where t2.c=t.f1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) # materialized query specifying t with t as (select a, count(*) from t1 where b >= 'c' group by a) select * from t2,t where t2.c=t.a; @@ -83,17 +83,17 @@ c a count(*) explain with t as (select a, count(*) from t1 where b >= 'c' group by a) select * from t2,t where t2.c=t.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort explain select * from t2, (select a, count(*) from t1 where b >= 'c' group by a) as t where t2.c=t.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort # specivication of t contains having with t as (select a, count(*) from t1 where b >= 'c' group by a having count(*)=1 ) @@ -149,17 +149,17 @@ c explain with t as (select a from t1 where a<5) select * from t2 where c in (select a from t); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 Using where explain select * from t2 where c in (select a from (select a from t1 where a<5) as t); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 Using where # materialized t is used in a subquery with t as (select count(*) as c from t1 where b >= 'c' group by a) select * from t2 where c in (select c from t); @@ -173,18 +173,18 @@ c explain with t as (select count(*) as c from t1 where b >= 'c' group by a) select * from t2 where c in (select c from t); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where -1 PRIMARY <derived2> ref key0 key0 8 test.t2.c 2 Using where; FirstMatch(t2) -2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where +1 PRIMARY <derived2> NULL ref key0 key0 8 test.t2.c 2 Using where; FirstMatch(t2) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort explain select * from t2 where c in (select c from (select count(*) as c from t1 where b >= 'c' group by a) as t); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where -1 PRIMARY <derived3> ref key0 key0 8 test.t2.c 2 Using where; FirstMatch(t2) -3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where +1 PRIMARY <derived3> NULL ref key0 key0 8 test.t2.c 2 Using where; FirstMatch(t2) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort # two references to t specified by a query # selecting a field: both in main query with t as (select a from t1 where b >= 'c') @@ -215,16 +215,16 @@ a a explain with t as (select a from t1 where b >= 'c') select * from t as r1, t as r2 where r1.a=r2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) explain select * from (select a from t1 where b >= 'c') as r1, (select a from t1 where b >= 'c') as r2 where r1.a=r2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) # two references to materialized t: both in main query with t as (select distinct a from t1 where b >= 'c') select * from t as r1, t as r2 where r1.a=r2.a; @@ -242,20 +242,20 @@ a a explain with t as (select distinct a from t1 where b >= 'c') select * from t as r1, t as r2 where r1.a=r2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8 Using where -1 PRIMARY <derived3> ref key0 key0 5 r1.a 1 -3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary -2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 8 Using where +1 PRIMARY <derived3> NULL ref key0 key0 5 r1.a 1 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using temporary +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using temporary explain select * from (select distinct a from t1 where b >= 'c') as r1, (select distinct a from t1 where b >= 'c') as r2 where r1.a=r2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8 Using where -1 PRIMARY <derived3> ref key0 key0 5 r1.a 1 -3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary -2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 8 Using where +1 PRIMARY <derived3> NULL ref key0 key0 5 r1.a 1 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using temporary +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using temporary # two references to t specified by a query # selecting all fields: both in main query with t as (select * from t1 where b >= 'c') @@ -286,16 +286,16 @@ a b a b explain with t as (select * from t1 where b >= 'c') select * from t as r1, t as r2 where r1.a=r2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) explain select * from (select * from t1 where b >= 'c') as r1, (select * from t1 where b >= 'c') as r2 where r1.a=r2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) # two references to t specifying explicitly column names with t(c) as (select a from t1 where b >= 'c') select * from t r1, t r2 where r1.c=r2.c; @@ -330,20 +330,20 @@ with t as (select a from t1 where b >= 'c') select * from t where a < 2 union select * from t where a >= 4; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where -3 UNION t1 ALL NULL NULL NULL NULL 8 Using where -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where +3 UNION t1 NULL ALL NULL NULL NULL NULL 8 Using where +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL explain select * from (select a from t1 where b >= 'c') as t where t.a < 2 union select * from (select a from t1 where b >= 'c') as t where t.a >= 4; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where -3 UNION t1 ALL NULL NULL NULL NULL 8 Using where -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where +3 UNION t1 NULL ALL NULL NULL NULL NULL 8 Using where +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL # specification of t contains union with t as (select a from t1 where b >= 'f' union @@ -367,24 +367,24 @@ with t as (select a from t1 where b >= 'f' union select c as a from t2 where c < 4) select * from t2,t where t2.c=t.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 1 -2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where -3 UNION t2 ALL NULL NULL NULL NULL 4 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c 1 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 Using where +3 UNION t2 NULL ALL NULL NULL NULL NULL 4 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain select * from t2, (select a from t1 where b >= 'f' union select c as a from t2 where c < 4) as t where t2.c=t.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 1 -2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where -3 UNION t2 ALL NULL NULL NULL NULL 4 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c 1 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 Using where +3 UNION t2 NULL ALL NULL NULL NULL NULL 4 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL # t is defined in the with clause of a subquery select t1.a,t1.b from t1,t2 where t1.a>t2.c and @@ -416,24 +416,24 @@ select t1.a,t1.b from t1,t2 where t1.a>t2.c and t2.c in (with t as (select * from t1 where t1.a<5) select t2.c from t2,t where t2.c=t.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) explain select t1.a,t1.b from t1,t2 where t1.a>t2.c and t2.c in (select t2.c from t2,(select * from t1 where t1.a<5) as t where t2.c=t.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) # two different definitions of t: one in the with clause of the main query, # the other in the with clause of a subquery with t as (select c from t2 where c >= 4) @@ -459,23 +459,23 @@ select t1.a,t1.b from t1,t where t1.a=t.c and t.c in (with t as (select * from t1 where t1.a<5) select t2.c from t2,t where t2.c=t.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where -1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) -4 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where -4 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where +1 PRIMARY <subquery4> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +4 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where +4 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) explain select t1.a,t1.b from t1, (select c from t2 where c >= 4) as t where t1.a=t.c and t.c in (select t2.c from t2, (select * from t1 where t1.a<5) as t where t2.c=t.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) # another with table tt is defined in the with clause of a subquery # from the specification of t with t as (select * from t1 @@ -504,12 +504,12 @@ where a>2 and b in (with tt as (select * from t2 where t2.c<5) select t1.b from t1,tt where t1.a=tt.c)) select t.a, count(*) from t1,t where t1.a=t.a group by t.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 35 func 1 -4 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where -4 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <subquery4> NULL eq_ref distinct_key distinct_key 35 func 1 +4 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where +4 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) explain select t.a, count(*) from t1, @@ -520,12 +520,12 @@ from t1, (select * from t2 where t2.c<5) as tt where t1.a=tt.c)) as t where t1.a=t.a group by t.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 35 func 1 -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 35 func 1 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) # with clause in the specification of a derived table select * from t1, @@ -550,10 +550,10 @@ from t1, (with t as (select a from t1 where b >= 'c') select * from t2,t where t2.c=t.a) as tt where t1.b > 'f' and tt.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (incremental, BNL join) explain select * from t1, @@ -561,10 +561,10 @@ from t1, (select a from t1 where b >= 'c') as t where t2.c=t.a) as tt where t1.b > 'f' and tt.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (incremental, BNL join) # with claused in the specification of a view create view v1 as with t as (select a from t1 where b >= 'c') @@ -579,9 +579,9 @@ c a 4 4 explain select * from v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) # with claused in the specification of a materialized view create view v2 as with t as (select a, count(*) from t1 where b >= 'c' group by a) @@ -595,10 +595,10 @@ c a count(*) 3 3 1 explain select * from v2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort # with clause in the specification of a view that whose definition # table alias for a with table create view v3 as @@ -627,9 +627,9 @@ c d 4 4 explain select * from v4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) drop view v1,v2,v3,v4; # currently any views containing with clause are not updatable create view v1(a) as @@ -787,15 +787,15 @@ ERROR 42S21: Duplicate column name 'f1' explain with t as (select a from t1 where b >= 'c') select t1.b from t2,t1 where t1.a = t2.c; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) explain with t as (select a, count(*) from t1 where b >= 'c' group by a) select t1.b from t2,t1 where t1.a = t2.c; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) # too many with elements in with clause with s65 as (select * from t1), s64 as (select * from t1) , s63 as (select * from t1) , s62 as (select * from t1) , s61 as (select * from t1) , s60 as (select * from t1) , s59 as (select * from t1) , s58 as (select * from t1) , s57 as (select * from t1) , s56 as (select * from t1) , s55 as (select * from t1) , s54 as (select * from t1) , s53 as (select * from t1) , s52 as (select * from t1) , s51 as (select * from t1) , s50 as (select * from t1) , s49 as (select * from t1) , s48 as (select * from t1) , s47 as (select * from t1) , s46 as (select * from t1) , s45 as (select * from t1) , s44 as (select * from t1) , s43 as (select * from t1) , s42 as (select * from t1) , s41 as (select * from t1) , s40 as (select * from t1) , s39 as (select * from t1) , s38 as (select * from t1) , s37 as (select * from t1) , s36 as (select * from t1) , s35 as (select * from t1) , s34 as (select * from t1) , s33 as (select * from t1) , s32 as (select * from t1) , s31 as (select * from t1) , s30 as (selec t * from t1) , s29 as (select * from t1) , s28 as (select * from t1) , s27 as (select * from t1) , s26 as (select * from t1) , s25 as (select * from t1) , s24 as (select * from t1) , s23 as (select * from t1) , s22 as (select * from t1) , s21 as (select * from t1) , s20 as (select * from t1) , s19 as (select * from t1) , s18 as (select * from t1) , s17 as (select * from t1) , s16 as (select * from t1) , s15 as (select * from t1) , s14 as (select * from t1) , s13 as (select * from t1) , s12 as (select * from t1) , s11 as (select * from t1) , s10 as (select * from t1) , s9 as (select * from t1) , s8 as (select * from t1) , s7 as (select * from t1) , s6 as (select * from t1) , s5 as (select * from t1) , s4 as (select * from t1) , s3 as (select * from t1) , s2 as (select * from t1) , s1 as (select * from t1) select * from s65; ERROR HY000: Too many WITH elements in WITH clause @@ -862,9 +862,9 @@ SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT 1) AS t1; 1 1 EXPLAIN SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT 1) AS t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived3> system NULL NULL NULL NULL 1 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived3> NULL system NULL NULL NULL NULL 1 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used DROP TABLE t1; # # MDEV-10058: Suspicious EXPLAIN output for a derived table + WITH + joined table @@ -878,9 +878,9 @@ INSERT INTO t3 VALUES (1),(2),(3); EXPLAIN SELECT * FROM (WITH a AS (SELECT * FROM t1) (t2 NATURAL JOIN t3)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't2 NATURAL JOIN t3))' at line 1 explain SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT * FROM t2 NATURAL JOIN t3) AS d1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) DROP TABLE t1,t2,t3; # # MDEV-10729: Server crashes in st_select_lex::set_explain_type @@ -936,8 +936,8 @@ CREATE TABLE t1 (i INT, c VARCHAR(3)); INSERT INTO t1 VALUES (1,'foo'); EXPLAIN EXTENDED WITH cte AS ( SELECT * FROM t1 ) SELECT i FROM cte; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 with cte as (select `test`.`t1`.`i` AS `i`,`test`.`t1`.`c` AS `c` from `test`.`t1`)select 1 AS `i` from dual DROP TABLE t1; @@ -1070,14 +1070,14 @@ SUM(k) explain WITH d1 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id), d2 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id) SELECT * FROM d1 UNION SELECT * FROM d2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 9 -2 DERIVED t1 ALL NULL NULL NULL NULL 3 -2 DERIVED t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -4 UNION <derived3> ALL NULL NULL NULL NULL 9 -3 DERIVED t1 ALL NULL NULL NULL NULL 3 -3 DERIVED t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 9 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +4 UNION <derived3> NULL ALL NULL NULL NULL NULL 9 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +NULL UNION RESULT <union1,4> NULL ALL NULL NULL NULL NULL NULL DROP TABLE t1,t2; # # MDEV-13780: tower of embedding CTEs with multiple usage of them @@ -1115,16 +1115,16 @@ select * from cte_o as cto_o2 where a > 4 select * from cte_e as cte_e1 where a > 1 union select * from cte_e as cte_e2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived4> ALL NULL NULL NULL NULL 14 100.00 Using where -4 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where -5 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where -NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL -6 UNION <derived11> ALL NULL NULL NULL NULL 14 100.00 -11 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where -12 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where -NULL UNION RESULT <union11,12> ALL NULL NULL NULL NULL NULL NULL -NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 14 100.00 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +5 UNION t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +NULL UNION RESULT <union4,5> NULL ALL NULL NULL NULL NULL NULL NULL +6 UNION <derived11> NULL ALL NULL NULL NULL NULL 14 100.00 +11 DERIVED t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +12 UNION t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +NULL UNION RESULT <union11,12> NULL ALL NULL NULL NULL NULL NULL NULL +NULL UNION RESULT <union1,6> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 with cte_e as (with cte_o as (with cte_i as (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)/* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)/* select#4 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union /* select#5 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)/* select#1 */ select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union /* select#6 */ select `cte_e2`.`a` AS `a` from `cte_e` `cte_e2` drop table t1; diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result index e2ca6d0b118..7aea6355990 100644 --- a/mysql-test/main/cte_recursive.result +++ b/mysql-test/main/cte_recursive.result @@ -84,12 +84,12 @@ union select t2.a from t1,t2 where t1.a+1=t2.a ) select * from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 30 -2 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where -3 UNION t1 ALL NULL NULL NULL NULL 5 -3 UNION t2 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 30 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 5 Using where +3 UNION t1 NULL ALL NULL NULL NULL NULL 5 +3 UNION t2 NULL ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL #WITH RECURSIVE : defined t1 is recursive and uses only base table t2 with recursive t1 as @@ -112,12 +112,12 @@ union select t2.a from t1,t2 where t1.a+1=t2.a ) select * from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 -2 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where -3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 5 -3 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 5 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 5 Using where +3 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 5 +3 RECURSIVE UNION t2 NULL ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL # just WITH : types of t1 columns are determined by all parts of union create view v1 as with @@ -687,17 +687,17 @@ where p.id = ma.w_id select h.name, h.dob, w.name, w.dob from ancestor_couple_ids c, coupled_ancestors h, coupled_ancestors w where c.h_id = h.id and c.w_id= w.id; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -1 PRIMARY <derived3> ref key0 key0 5 c.h_id 2 100.00 -1 PRIMARY <derived3> ref key0 key0 5 c.w_id 2 100.00 -3 DERIVED folks ALL NULL NULL NULL NULL 12 100.00 Using where -4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 -4 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) -5 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 -5 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) -NULL UNION RESULT <union3,4,5> ALL NULL NULL NULL NULL NULL NULL -2 DERIVED <derived3> ALL NULL NULL NULL NULL 12 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY <derived3> NULL ref key0 key0 5 c.h_id 2 100.00 +1 PRIMARY <derived3> NULL ref key0 key0 5 c.w_id 2 100.00 +3 DERIVED folks NULL ALL NULL NULL NULL NULL 12 100.00 Using where +4 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +4 RECURSIVE UNION p NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +5 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +5 RECURSIVE UNION p NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +NULL UNION RESULT <union3,4,5> NULL ALL NULL NULL NULL NULL NULL NULL +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: Note 1003 with recursive ancestor_couple_ids(`h_id`,`w_id`) as (/* select#2 */ select `a`.`father` AS `h_id`,`a`.`mother` AS `w_id` from `coupled_ancestors` `a` where `a`.`father` is not null and `a`.`mother` is not null), coupled_ancestors(`id`,`name`,`dob`,`father`,`mother`) as (/* select#3 */ select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union all /* select#4 */ select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `fa` where `test`.`p`.`id` = `fa`.`h_id` union all /* select#5 */ select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancest or_couple_ids` `ma` where `test`.`p`.`id` = `ma`.`w_id`)/* select#1 */ select `h`.`name` AS `name`,`h`.`dob` AS `dob`,`w`.`name` AS `name`,`w`.`dob` AS `dob` from `ancestor_couple_ids` `c` join `coupled_ancestors` `h` join `coupled_ancestors` `w` where `h`.`id` = `c`.`h_id` and `w`.`id` = `c`.`w_id` # simple mutual recursion @@ -875,12 +875,12 @@ from folks as p, ancestors AS a where p.id = a.father or p.id = a.mother ) select * from ancestors; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12 100.00 -2 DERIVED folks ALL NULL NULL NULL NULL 12 100.00 Using where -3 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00 -3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 12 100.00 +2 DERIVED folks NULL ALL NULL NULL NULL NULL 12 100.00 Using where +3 RECURSIVE UNION p NULL ALL NULL NULL NULL NULL 12 100.00 +3 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 with recursive ancestors as (/* select#2 */ select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' and `test`.`folks`.`dob` = DATE'2000-01-01' union /* select#3 */ select `p`.`id` AS `id`,`p`.`name` AS `name`,`p`.`dob` AS `dob`,`p`.`father` AS `father`,`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestors` `a` where `a`.`father` = `p`.`id` or `a`.`mother` = `p`.`id`)/* select#1 */ select `ancestors`.`id` AS `id`,`ancestors`.`name` AS `name`,`ancestors`.`dob` AS `dob`,`ancestors`.`father` AS `father`,`ancestors`.`mother` AS `mother` from `ancestors` # recursive spec with two anchor selects and two recursive ones @@ -1234,14 +1234,14 @@ from folks as p, ancestors as ma where p.id = ma.mother ) select * from ancestors; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12 -2 DERIVED folks ALL NULL NULL NULL NULL 12 Using where -3 RECURSIVE UNION p ALL PRIMARY NULL NULL NULL 12 -3 RECURSIVE UNION <derived2> ref key0 key0 5 test.p.id 2 -4 RECURSIVE UNION p ALL PRIMARY NULL NULL NULL 12 -4 RECURSIVE UNION <derived2> ref key0 key0 5 test.p.id 2 -NULL UNION RESULT <union2,3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 12 +2 DERIVED folks NULL ALL NULL NULL NULL NULL 12 Using where +3 RECURSIVE UNION p NULL ALL PRIMARY NULL NULL NULL 12 +3 RECURSIVE UNION <derived2> NULL ref key0 key0 5 test.p.id 2 +4 RECURSIVE UNION p NULL ALL PRIMARY NULL NULL NULL 12 +4 RECURSIVE UNION <derived2> NULL ref key0 key0 5 test.p.id 2 +NULL UNION RESULT <union2,3,4> NULL ALL NULL NULL NULL NULL NULL with recursive ancestors as @@ -1298,16 +1298,16 @@ select * from prev_gen ) select ancestors.name, ancestors.dob from ancestors; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived4> ALL NULL NULL NULL NULL 24 -4 DERIVED folks ALL NULL NULL NULL NULL 12 Using where -6 UNION <derived3> ALL NULL NULL NULL NULL 12 -5 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 24 -NULL UNION RESULT <union4,6,5> ALL NULL NULL NULL NULL NULL -3 DERIVED folks ALL NULL NULL NULL NULL 12 Using where -2 RECURSIVE UNION folks ALL PRIMARY NULL NULL NULL 12 -2 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -NULL UNION RESULT <union3,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 24 +4 DERIVED folks NULL ALL NULL NULL NULL NULL 12 Using where +6 UNION <derived3> NULL ALL NULL NULL NULL NULL 12 +5 RECURSIVE UNION <derived4> NULL ALL NULL NULL NULL NULL 24 +NULL UNION RESULT <union4,6,5> NULL ALL NULL NULL NULL NULL NULL +3 DERIVED folks NULL ALL NULL NULL NULL NULL 12 Using where +2 RECURSIVE UNION folks NULL ALL PRIMARY NULL NULL NULL 12 +2 RECURSIVE UNION <derived3> NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +NULL UNION RESULT <union3,2> NULL ALL NULL NULL NULL NULL NULL explain FORMAT=JSON with recursive prev_gen @@ -1930,12 +1930,12 @@ union select t2.a from t1,t2 where t1.a+1=t2.a ) select * from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 -2 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where -4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 5 -4 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) -NULL UNION RESULT <union2,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 5 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 5 Using where +4 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 5 +4 RECURSIVE UNION t2 NULL ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +NULL UNION RESULT <union2,4> NULL ALL NULL NULL NULL NULL NULL drop table t1,t2; # # MDEV-11278: non-mergeable view in the spec of recursive CTE @@ -2893,12 +2893,12 @@ SELECT c1 FROM t UNION SELECT c1 FROM t, cte ) SELECT COUNT(*) FROM cte; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 -2 DERIVED t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 -3 RECURSIVE UNION t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 -3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using join buffer (flat, BNL join) -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 +2 DERIVED t NULL ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 +3 RECURSIVE UNION t NULL ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 +3 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using join buffer (flat, BNL join) +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL 0.00 NULL NULL WITH RECURSIVE cte(f) AS ( SELECT c1 FROM t UNION @@ -2911,12 +2911,12 @@ SELECT c2 FROM t UNION SELECT c2 FROM t, cte ) SELECT COUNT(*) FROM cte; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 -2 DERIVED t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 -3 RECURSIVE UNION t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 -3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using join buffer (flat, BNL join) -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 +2 DERIVED t NULL ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 +3 RECURSIVE UNION t NULL ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 +3 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using join buffer (flat, BNL join) +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL 0.00 NULL NULL WITH RECURSIVE cte(f) AS ( SELECT c2 FROM t UNION @@ -3151,13 +3151,13 @@ select b.arrival, r.legs + 1 from destinations r, flights b where r.city=b.departure and b.arrival not in (select city from destinations) ) select * from destinations; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 16 100.00 -2 DERIVED a ALL NULL NULL NULL NULL 16 100.00 Using where -3 RECURSIVE UNION b ALL NULL NULL NULL NULL 16 100.00 Using where -3 RECURSIVE UNION <derived2> ref key0 key0 35 test.b.departure 2 100.00 -4 DEPENDENT SUBQUERY <derived2> ALL NULL NULL NULL NULL 16 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 16 100.00 +2 DERIVED a NULL ALL NULL NULL NULL NULL 16 100.00 Using where +3 RECURSIVE UNION b NULL ALL NULL NULL NULL NULL 16 100.00 Using where +3 RECURSIVE UNION <derived2> NULL ref key0 key0 35 test.b.departure 2 100.00 +4 DEPENDENT SUBQUERY <derived2> NULL ALL NULL NULL NULL NULL 16 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 with recursive destinations(`city`,`legs`) as (/* select#2 */ select `test`.`a`.`arrival` AS `city`,1 AS `legs` from `test`.`flights` `a` where `test`.`a`.`departure` = 'Cairo' union /* select#3 */ select `test`.`b`.`arrival` AS `arrival`,`r`.`legs` + 1 AS `r.legs + 1` from `destinations` `r` join `test`.`flights` `b` where `r`.`city` = `test`.`b`.`departure` and !(<in_optimizer>(`test`.`b`.`arrival`,<exists>(/* select#4 */ select `destinations`.`city` from `destinations` where trigcond(`test`.`b`.`arrival` = `destinations`.`city` or `destinations`.`city` is null) having trigcond(`destinations`.`city` is null)))))/* select#1 */ select `destinations`.`city` AS `city`,`destinations`.`legs` AS `legs` from `destinations` set standard_compliant_cte=default; @@ -3254,14 +3254,14 @@ SELECT t2.*, concat(tree_of_a.path,",",t2.id) FROM t2 JOIN tree_of_a ON t2.id=tree_of_a.rightpar) SELECT * FROM tree_of_a ORDER BY path; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 15 Using filesort -2 DERIVED t2 ALL NULL NULL NULL NULL 15 Using where -3 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 15 Using where -3 RECURSIVE UNION <derived2> ref key0 key0 5 test.t2.id 2 -4 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 15 Using where -4 RECURSIVE UNION <derived2> ref key0 key0 5 test.t2.id 2 -NULL UNION RESULT <union2,3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 15 Using filesort +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 15 Using where +3 RECURSIVE UNION t2 NULL ALL NULL NULL NULL NULL 15 Using where +3 RECURSIVE UNION <derived2> NULL ref key0 key0 5 test.t2.id 2 +4 RECURSIVE UNION t2 NULL ALL NULL NULL NULL NULL 15 Using where +4 RECURSIVE UNION <derived2> NULL ref key0 key0 5 test.t2.id 2 +NULL UNION RESULT <union2,3,4> NULL ALL NULL NULL NULL NULL NULL DROP TABLE t1,t2; set tmp_memory_table_size=default; # @@ -3435,16 +3435,16 @@ cte1 as cte2 as (select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7) select * from cte1, cte2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived4> ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <derived5> ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join) -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL -4 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -4 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -5 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -5 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <derived5> NULL ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join) +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL +4 DERIVED <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +5 DERIVED <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +5 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 with recursive rcte(`a`) as (/* select#2 */ select 1 AS `a` union /* select#3 */ select cast(`rcte`.`a` + 1 as unsigned) AS `cast(a+1 as unsigned)` from `rcte` where `rcte`.`a` < 10), cte1 as (/* select#4 */ select count(0) AS `c1` from `rcte` join `test`.`t1` where `rcte`.`a` between 3 and 5 and `test`.`t1`.`id` = `rcte`.`a` - 3), cte2 as (/* select#5 */ select count(0) AS `c2` from `rcte` join `test`.`t1` where `rcte`.`a` between 7 and 8 and `test`.`t1`.`id` = `rcte`.`a` - 7)/* select#1 */ select `cte1`.`c1` AS `c1`,`cte2`.`c2` AS `c2` from `cte1` join `cte2` prepare stmt from "with recursive @@ -3521,16 +3521,16 @@ cte1 as cte2 as (select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7) select * from cte2, cte1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived5> ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <derived4> ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join) -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL -5 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -5 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -4 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -4 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived5> NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join) +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL +5 DERIVED <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +5 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +4 DERIVED <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 with recursive rcte(`a`) as (/* select#2 */ select 1 AS `a` union /* select#3 */ select cast(`rcte`.`a` + 1 as unsigned) AS `cast(a+1 as unsigned)` from `rcte` where `rcte`.`a` < 10), cte1 as (/* select#4 */ select count(0) AS `c1` from `rcte` join `test`.`t1` where `rcte`.`a` between 3 and 5 and `test`.`t1`.`id` = `rcte`.`a` - 3), cte2 as (/* select#5 */ select count(0) AS `c2` from `rcte` join `test`.`t1` where `rcte`.`a` between 7 and 8 and `test`.`t1`.`id` = `rcte`.`a` - 7)/* select#1 */ select `cte2`.`c2` AS `c2`,`cte1`.`c1` AS `c1` from `cte2` join `cte1` prepare stmt from "with recursive @@ -3780,11 +3780,11 @@ explain extended with recursive cte as (select * from t1 where a=1 union select a+1 from cte where a<3) select * from cte as t; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 4 100.00 Using where -3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +3 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 4 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 with recursive cte as (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 union /* select#3 */ select `cte`.`a` + 1 AS `a+1` from `cte` where `cte`.`a` < 3)/* select#1 */ select `t`.`a` AS `a` from `cte` `t` with recursive cte as @@ -3798,8 +3798,8 @@ explain extended with recursive cte as (select * from t1 where a=1 union select a+1 from cte where a<3) select * from t1 as t; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t ALL NULL NULL NULL NULL 4 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 4 100.00 Warnings: Note 1003 with recursive cte as (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 union /* select#3 */ select `cte`.`a` + 1 AS `a+1` from `cte` where `cte`.`a` < 3)/* select#1 */ select `test`.`t`.`a` AS `a` from `test`.`t1` `t` with recursive cte as @@ -3816,8 +3816,8 @@ explain with recursive cte as ( select * from t2 union select s1.* from t2 as s1, cte where s1.i1 = cte.i2 ) select * from t2 as t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 2 drop table t1,t2; # # MDEV-22042: ANALYZE of query using stored function and recursive CTE @@ -3847,13 +3847,13 @@ from (select t1.a1, f1(t1.a2) fv from t1) dt where (dt.a1) in (with recursive cte as (select a2 from t2 where a2='2' union select tt2.a2 from t2 tt2 join cte on tt2.b1=cte.a2) select a2 from cte); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY <derived3> ref key0 key0 23 test.t1.a1 1 FirstMatch(t1) -3 DERIVED t2 const PRIMARY PRIMARY 22 const 1 Using index -4 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 2 Using where -4 RECURSIVE UNION tt2 ref b1 b1 23 cte.a2 2 -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY <derived3> NULL ref key0 key0 23 test.t1.a1 1 FirstMatch(t1) +3 DERIVED t2 NULL const PRIMARY PRIMARY 22 const 1 Using index +4 RECURSIVE UNION <derived3> NULL ALL NULL NULL NULL NULL 2 Using where +4 RECURSIVE UNION tt2 NULL ref b1 b1 23 cte.a2 2 +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL analyze format=json select fv from (select t1.a1, f1(t1.a2) fv from t1) dt where (dt.a1) in (with recursive cte as (select a2 from t2 where a2='2' @@ -4024,18 +4024,18 @@ FROM cte JOIN t2 ON t2.tm BETWEEN cte.st AND cte.fn), cte3 AS (SELECT YEAR, COUNT(*) FROM cte JOIN t3 ON t3.tm BETWEEN cte.st AND cte.fn) SELECT t1.* FROM t1 JOIN cte2 USING (YEAR) JOIN cte3 USING (YEAR); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY <derived5> ref key0 key0 5 const 0 0.00 -1 PRIMARY <derived4> ref key0 key0 5 const 0 0.00 -2 DERIVED t1 system NULL NULL NULL NULL 1 100.00 -3 RECURSIVE UNION t1 system NULL NULL NULL NULL 1 100.00 -3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL -4 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00 -4 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -5 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00 -5 DERIVED t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY <derived5> NULL ref key0 key0 5 const 0 0.00 +1 PRIMARY <derived4> NULL ref key0 key0 5 const 0 0.00 +2 DERIVED t1 NULL system NULL NULL NULL NULL 1 100.00 +3 RECURSIVE UNION t1 NULL system NULL NULL NULL NULL 1 100.00 +3 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL +4 DERIVED <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +4 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +5 DERIVED <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +5 DERIVED t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 with recursive cte as (/* select#2 */ select year(`test`.`t1`.`d1`) AS `YEAR`,`test`.`t1`.`d1` AS `st`,`test`.`t1`.`d1` + interval 1 month AS `fn` from `test`.`t1` union all /* select#3 */ select year(`cte`.`st` + interval 1 month) AS `YEAR(cte.st + INTERVAL 1 MONTH)`,`cte`.`st` + interval 1 month AS `cte.st + INTERVAL 1 MONTH`,`test`.`t1`.`d2` + interval 1 day AS `t1.d2 + INTERVAL 1 DAY` from `cte` join `test`.`t1` where `cte`.`st` + interval 1 month < `test`.`t1`.`d2`), cte2 as (/* select#4 */ select `cte`.`YEAR` AS `YEAR`,count(0) AS `COUNT(*)` from `cte` join `test`.`t2` where `test`.`t2`.`tm` between `cte`.`st` and `cte`.`fn`), cte3 as (/* select#5 */ select `cte`.`YEAR` AS `YEAR`,count(0) AS `COUNT(*)` from `cte` join `test`.`t3` where `test`.`t3`.`tm` between `cte`.`st` and `cte`.`fn`)/* select#1 */ select 2018 AS `YEAR`,'2018-01-01' AS `d1`,'2018-09-20' AS `d2` from `cte2` join `cte3` where `cte3`.`YEAR` = 2018 and `cte2`.`YEAR` = 2018 PREPARE stmt FROM "WITH RECURSIVE @@ -4095,13 +4095,13 @@ explain with recursive r_cte as union select t1.* from t1, r_cte as r where t1.c = r.a ) select 0 as b FROM dual union all select b FROM r_cte as t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DERIVED s ALL NULL NULL NULL NULL 4 -3 RECURSIVE UNION t1 ALL NULL NULL NULL NULL 4 Using where -3 RECURSIVE UNION <derived2> ref key0 key0 9 test.t1.c 2 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL -4 UNION <derived2> ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 DERIVED s NULL ALL NULL NULL NULL NULL 4 +3 RECURSIVE UNION t1 NULL ALL NULL NULL NULL NULL 4 Using where +3 RECURSIVE UNION <derived2> NULL ref key0 key0 9 test.t1.c 2 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL +4 UNION <derived2> NULL ALL NULL NULL NULL NULL 4 with recursive r_cte as ( select * from t1 as s union @@ -4266,8 +4266,8 @@ union select t1.* from t1, r_cte as r where t1.c = r.a ) select 0 as b FROM dual union all select b FROM r_cte as t) select * from t1 as tt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY tt ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY tt NULL ALL NULL NULL NULL NULL 4 with h_cte as ( with recursive r_cte as ( select * from t1 as s @@ -4353,11 +4353,11 @@ a explain with recursive cte as (select * from db1.t1 union select * from (select * from cte) as t) select * from cte; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 -2 DERIVED t1 ALL NULL NULL NULL NULL 3 -3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 3 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 +3 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 3 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL prepare stmt from "with recursive cte as (select * from db1.t1 union select * from (select * from cte) as t) select * from cte"; @@ -4450,18 +4450,18 @@ from ancestor_couples ) select h_name, h_dob, w_name, w_dob from ancestor_couples; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 1728 -4 DERIVED <derived3> ALL NULL NULL NULL NULL 1728 -5 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 1728 -NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL -3 DERIVED v ALL NULL NULL NULL NULL 12 Using where -3 DERIVED h ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -3 DERIVED w ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join) -2 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 2 -2 RECURSIVE UNION h ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -2 RECURSIVE UNION w ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join) -NULL UNION RESULT <union3,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 1728 +4 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 1728 +5 RECURSIVE UNION <derived3> NULL ALL NULL NULL NULL NULL 1728 +NULL UNION RESULT <union4,5> NULL ALL NULL NULL NULL NULL NULL +3 DERIVED v NULL ALL NULL NULL NULL NULL 12 Using where +3 DERIVED h NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +3 DERIVED w NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join) +2 RECURSIVE UNION <derived4> NULL ALL NULL NULL NULL NULL 2 +2 RECURSIVE UNION h NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +2 RECURSIVE UNION w NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join) +NULL UNION RESULT <union3,2> NULL ALL NULL NULL NULL NULL NULL prepare stmt from "with recursive ancestor_couples(h_id, h_name, h_dob, h_father, h_mother, w_id, w_name, w_dob, w_father, w_mother) @@ -4550,15 +4550,15 @@ from ancestor_couples ) select h_name, h_dob, w_name, w_dob from ancestor_couples; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -3 DERIVED folks ALL NULL NULL NULL NULL 12 Using where -4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 -5 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 -NULL UNION RESULT <union3,4,5> ALL NULL NULL NULL NULL NULL -2 DERIVED h ALL NULL NULL NULL NULL 12 -2 DERIVED w ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join) -2 DERIVED <derived3> ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +3 DERIVED folks NULL ALL NULL NULL NULL NULL 12 Using where +4 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 2 +5 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 2 +NULL UNION RESULT <union3,4,5> NULL ALL NULL NULL NULL NULL NULL +2 DERIVED h NULL ALL NULL NULL NULL NULL 12 +2 DERIVED w NULL ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join) +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (incremental, BNL join) prepare stmt from "with recursive ancestor_couples(h_id, h_name, h_dob, h_father, h_mother, w_id, w_name, w_dob, w_father, w_mother) diff --git a/mysql-test/main/ctype_binary.result b/mysql-test/main/ctype_binary.result index 05f31f13dc7..ee84659367e 100644 --- a/mysql-test/main/ctype_binary.result +++ b/mysql-test/main/ctype_binary.result @@ -2764,12 +2764,12 @@ date_column DATE DEFAULT NULL, KEY(date_column)); INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01'); EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 4 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range date_column date_column 4 NULL 2 Using index condition ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL; EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 6 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range date_column date_column 6 NULL 2 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data @@ -2866,12 +2866,12 @@ END// CALL p1; v_LastPaymentDate < NOW() NULL -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()` -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select concat(v_LastPaymentDate@0,current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; @@ -2944,8 +2944,8 @@ a SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; c1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 0 DROP TABLE t1; @@ -2965,8 +2965,8 @@ a SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); c1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 0 DROP TABLE t1; @@ -2986,8 +2986,8 @@ c1 SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 0 DROP TABLE t1; @@ -3008,8 +3008,8 @@ SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -3030,8 +3030,8 @@ SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; a LENGTH(a) a 1 EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' DROP TABLE t1; @@ -3083,8 +3083,8 @@ a LENGTH(a) CRC32(a) a 1 3904355907 # Okey to propagate 'a' into CRC32(a) EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)`,crc32(`test`.`t1`.`a`) AS `CRC32(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61'; @@ -3095,8 +3095,8 @@ a HEX(a) a 61 # Okey to propagate 'a' into HEX(a) EXPLAIN EXTENDED SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`a`) AS `HEX(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' SELECT * FROM t1 WHERE a='a'; @@ -3109,8 +3109,8 @@ SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2; a # Okey to propagate 'a' into LENGTH(a) EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 SELECT * FROM t1 WHERE a='a '; @@ -3121,8 +3121,8 @@ a a # Okey to propagate 'a ' into LENGTH(a) EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a ' AND LENGTH(a)=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a ' DROP TABLE t1; @@ -3144,23 +3144,23 @@ SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a'; a a EXPLAIN EXTENDED SELECT * FROM t1 WHERE COLLATION(a)='binary' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' EXPLAIN EXTENDED SELECT * FROM t1 WHERE CHARSET(a)='binary' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' EXPLAIN EXTENDED SELECT * FROM t1 WHERE COERCIBILITY(a)=2 AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' EXPLAIN EXTENDED SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and weight_string(`test`.`t1`.`a`,0,0,1) = 'a' DROP TABLE t1; diff --git a/mysql-test/main/ctype_collate.result b/mysql-test/main/ctype_collate.result index 93bf07908b5..6b4acff6a52 100644 --- a/mysql-test/main/ctype_collate.result +++ b/mysql-test/main/ctype_collate.result @@ -516,8 +516,8 @@ SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; charset('a') collation('a') coercibility('a') 'a'='A' latin1 latin1_swedish_ci 4 1 explain extended SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select charset('a') AS `charset('a')`,collation('a') AS `collation('a')`,coercibility('a') AS `coercibility('a')`,'a' = 'A' AS `'a'='A'` SET CHARACTER SET koi8r; @@ -595,35 +595,35 @@ INSERT INTO t1 VALUES ('h','h'); INSERT INTO t1 VALUES ('i','i'); INSERT INTO t1 VALUES ('j','j'); EXPLAIN SELECT * FROM t1 WHERE s1='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref s1 s1 11 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref s1 s1 11 const 1 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref s2 s2 11 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref s2 s2 11 const 1 Using index condition EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref s1 s1 11 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref s1 s1 11 const 1 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 Using where EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range s1 s1 11 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range s1 s1 11 NULL 2 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 Using where EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range s1 s1 11 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range s1 s1 11 NULL 2 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 Using where EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range s1 s1 11 NULL 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range s1 s1 11 NULL 1 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 Using where DROP TABLE t1; create table t1(f1 varchar(10) character set latin2 collate latin2_hungarian_ci, key(f1)); insert into t1 set f1=0x3F3F9DC73F; @@ -737,8 +737,8 @@ Warning 1280 Name 'b' ignored for PRIMARY key. INSERT INTO t1 (b) VALUES ('a'), (_binary 0x1), (_binary 0x0), (''); explain select hex(b) from t1 force index (PRIMARY) where b<'zzz'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 34 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 34 NULL 4 Using where select hex(b) from t1 force index (PRIMARY) where b<'zzz'; hex(b) 00 @@ -747,8 +747,8 @@ hex(b) 61 explain select hex(b) from t1 where b<'zzz' order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 4 Using where; Using filesort select hex(b) from t1 where b<'zzz' order by b; hex(b) 00 diff --git a/mysql-test/main/ctype_cp1250_ch.result b/mysql-test/main/ctype_cp1250_ch.result index b662b5c7740..9dcf058b84f 100644 --- a/mysql-test/main/ctype_cp1250_ch.result +++ b/mysql-test/main/ctype_cp1250_ch.result @@ -126,8 +126,8 @@ SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; @@ -149,8 +149,8 @@ SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -172,8 +172,8 @@ SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -195,8 +195,8 @@ SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -217,8 +217,8 @@ SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; a LENGTH(a) a 1 EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a' DROP TABLE t1; diff --git a/mysql-test/main/ctype_cp1251.result b/mysql-test/main/ctype_cp1251.result index 5d0bf3be615..0ae805265e1 100644 --- a/mysql-test/main/ctype_cp1251.result +++ b/mysql-test/main/ctype_cp1251.result @@ -3176,12 +3176,12 @@ date_column DATE DEFAULT NULL, KEY(date_column)); INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01'); EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 4 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range date_column date_column 4 NULL 2 Using index condition ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL; EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 6 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range date_column date_column 6 NULL 2 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data @@ -3278,12 +3278,12 @@ END// CALL p1; v_LastPaymentDate < NOW() NULL -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()` -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select concat(convert(v_LastPaymentDate@0 using cp1251),current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; @@ -3385,13 +3385,13 @@ a Warnings: Warning 1292 Truncated incorrect DOUBLE value: '`1' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = ' 1' and `test`.`t1`.`a` in (1,2,3) EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3,'x') AND a=' 1'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = ' 1' and `test`.`t1`.`a` in (1,2,3,'x') DROP TABLE t1; @@ -3416,8 +3416,8 @@ Warnings: Warning 1292 Truncated incorrect INTEGER value: '`1' # ' 1' should not be propagated into (a XIR '0') EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = ' 1' and (`test`.`t1`.`a` xor '0') DROP TABLE t1; diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result index 0b16d1cf6f2..365b24bd57c 100644 --- a/mysql-test/main/ctype_latin1.result +++ b/mysql-test/main/ctype_latin1.result @@ -3485,12 +3485,12 @@ date_column DATE DEFAULT NULL, KEY(date_column)); INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01'); EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 4 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range date_column date_column 4 NULL 2 Using index condition ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL; EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 6 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range date_column date_column 6 NULL 2 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data @@ -3587,12 +3587,12 @@ END// CALL p1; v_LastPaymentDate < NOW() NULL -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()` -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select concat(v_LastPaymentDate@0,current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; @@ -3647,14 +3647,14 @@ SET sql_mode=default; # SET NAMES utf8; EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 'abcdó' AS `abcdó`,_latin1'abcd\xC3\xB3' AS `abcdó`,_utf8mb3'abcd\xC3\xB3' AS `abcdó` SET NAMES latin1; EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 'abcdó' AS `abcdó`,_latin1'abcd\xC3\xB3' AS `abcdó`,_utf8mb3'abcd\xC3\xB3' AS `abcd�` # @@ -7737,8 +7737,8 @@ SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; @@ -7760,8 +7760,8 @@ SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -7783,8 +7783,8 @@ SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -7806,8 +7806,8 @@ SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -7828,8 +7828,8 @@ SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; a LENGTH(a) a 1 EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; @@ -7858,8 +7858,8 @@ SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; @@ -7881,8 +7881,8 @@ SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -7904,8 +7904,8 @@ SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -7927,8 +7927,8 @@ SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -7949,8 +7949,8 @@ SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; a LENGTH(a) a 1 EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; @@ -8096,13 +8096,13 @@ DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(10)); INSERT INTO t1 VALUES ('10'),('11'),('12'); EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND IF(a='10',1,0)=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '10' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND CASE WHEN a='10' THEN 1 ELSE 0 END; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '10' DROP TABLE t1; @@ -8119,8 +8119,8 @@ SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a'; a a EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` in (<cache>('a' collate latin1_bin),'b') DROP TABLE t1; @@ -8139,8 +8139,8 @@ SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin AND a='a'; a a EXPLAIN EXTENDED SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` between 'a' and <cache>('c' collate latin1_bin) DROP TABLE t1; @@ -8221,8 +8221,8 @@ a LENGTH(a) CRC32(a) a 1 3904355907 # 'a' should not be propagated into CRC32(a) EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)`,crc32(`test`.`t1`.`a`) AS `CRC32(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and crc32(`test`.`t1`.`a`) = 3904355907 SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61'; @@ -8233,8 +8233,8 @@ a HEX(a) a 61 # 'a' should not be propagated into HEX(a) EXPLAIN EXTENDED SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`a`) AS `HEX(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and hex(`test`.`t1`.`a`) = '61' SELECT * FROM t1 WHERE a='a'; @@ -8249,8 +8249,8 @@ a a # 'a' should not be propagated into LENGTH(a) EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and octet_length(`test`.`t1`.`a`) = 2 DROP TABLE t1; @@ -8281,8 +8281,8 @@ CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10)); INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3'); EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(c,0)='3 ' AND COALESCE(d,0)=COALESCE(c,0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where coalesce(`test`.`t1`.`c`,0) = '3 ' and coalesce(`test`.`t1`.`d`,0) = '3 ' DROP TABLE t1; diff --git a/mysql-test/main/ctype_latin2_ch.result b/mysql-test/main/ctype_latin2_ch.result index 962c29f7ab4..aad57eabba8 100644 --- a/mysql-test/main/ctype_latin2_ch.result +++ b/mysql-test/main/ctype_latin2_ch.result @@ -68,8 +68,8 @@ SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; @@ -91,8 +91,8 @@ SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -114,8 +114,8 @@ SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -137,8 +137,8 @@ SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -159,8 +159,8 @@ SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; a LENGTH(a) a 1 EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; diff --git a/mysql-test/main/ctype_tis620.result b/mysql-test/main/ctype_tis620.result index a6f2db38319..550161d634c 100644 --- a/mysql-test/main/ctype_tis620.result +++ b/mysql-test/main/ctype_tis620.result @@ -3182,8 +3182,8 @@ SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; @@ -3205,8 +3205,8 @@ SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -3228,8 +3228,8 @@ SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -3251,8 +3251,8 @@ SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -3273,8 +3273,8 @@ SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; a LENGTH(a) a 1 EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; @@ -3404,8 +3404,8 @@ SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; @@ -3427,8 +3427,8 @@ SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -3450,8 +3450,8 @@ SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -3473,8 +3473,8 @@ SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -3495,8 +3495,8 @@ SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; a LENGTH(a) a 1 EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; diff --git a/mysql-test/main/ctype_uca.result b/mysql-test/main/ctype_uca.result index 279a3cdcd5d..09b2cb69924 100644 --- a/mysql-test/main/ctype_uca.result +++ b/mysql-test/main/ctype_uca.result @@ -6749,8 +6749,8 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; @@ -6768,14 +6768,14 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; ch EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; @@ -6818,8 +6818,8 @@ aЀ aր EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -6841,8 +6841,8 @@ aЀ aր EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; ch a @@ -6870,15 +6870,15 @@ ch z EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ch z EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; ch z @@ -6968,8 +6968,8 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; @@ -6987,14 +6987,14 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; ch EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; @@ -7037,8 +7037,8 @@ aЀ aր EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -7060,8 +7060,8 @@ aЀ aր EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; ch a @@ -7089,15 +7089,15 @@ ch z EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ch z EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; ch z @@ -8379,8 +8379,8 @@ F0909080 30D2 𐐀 F09090A8 30D2 𐐨 ALTER TABLE t1 ADD KEY(c); EXPLAIN SELECT hex(c) FROM t1 WHERE c LIKE 'a%' ORDER BY c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 43 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c c 43 NULL 3 Using where; Using index SELECT hex(c), hex(weight_string(c)) FROM t1 WHERE c LIKE 'a%' ORDER BY c; hex(c) hex(weight_string(c)) 61 120F @@ -8425,8 +8425,8 @@ SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; @@ -8448,8 +8448,8 @@ SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -8471,8 +8471,8 @@ SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -8494,8 +8494,8 @@ SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -8516,8 +8516,8 @@ SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; a LENGTH(a) a 1 EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a' DROP TABLE t1; @@ -8543,8 +8543,8 @@ ae SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; c1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` = 'ä' and `test`.`t1`.`c1` like 'ae' SELECT * FROM t1 WHERE CONCAT(c1)='ä'; @@ -8556,8 +8556,8 @@ ae SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'; c1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'ä' and concat(`test`.`t1`.`c1`) like 'ae' DROP TABLE IF EXISTS t1; @@ -8583,8 +8583,8 @@ SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; @@ -8606,8 +8606,8 @@ SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -8629,8 +8629,8 @@ SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -8652,8 +8652,8 @@ SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -8674,8 +8674,8 @@ SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; a LENGTH(a) a 1 EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a' DROP TABLE t1; @@ -8703,8 +8703,8 @@ SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; c1 ae EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` = 'ä' and `test`.`t1`.`c1` like 'ae' SELECT * FROM t1 WHERE CONCAT(c1)='ä'; @@ -8718,8 +8718,8 @@ SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'; c1 ae EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'ä' and concat(`test`.`t1`.`c1`) like 'ae' DROP TABLE IF EXISTS t1; @@ -13901,13 +13901,13 @@ SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe'; a oe EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' AND a='oe' COLLATE utf8_german2_ci; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'oe' and `test`.`t1`.`a` = 'oe' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'oe' and `test`.`t1`.`a` = 'oe' DROP TABLE t1; @@ -14237,8 +14237,8 @@ t1 CREATE TABLE `t1` ( # Ascending sort, using filesort # EXPLAIN SELECT a FROM t1 ORDER BY a, BINARY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 97 NULL 96 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 97 NULL 96 Using index; Using filesort SELECT a FROM t1 ORDER BY a, BINARY a; a -a @@ -14341,8 +14341,8 @@ vice-versa # Descending sort, using filesort # EXPLAIN SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 97 NULL 96 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 97 NULL 96 Using index; Using filesort SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; a ฯพณฯ @@ -14445,8 +14445,8 @@ A # Ascending sort, using index # EXPLAIN SELECT a FROM t1 ORDER BY a, id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 97 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 97 NULL 96 Using index SELECT a FROM t1 ORDER BY a, id; a -a @@ -14549,8 +14549,8 @@ vice-versa # Descending sort, using index # EXPLAIN SELECT a FROM t1 ORDER BY a DESC, id DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 97 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 97 NULL 96 Using index SELECT a FROM t1 ORDER BY a DESC, id DESC; a ฯพณฯ @@ -14931,8 +14931,8 @@ t1 CREATE TABLE `t1` ( # Ascending sort, using filesort # EXPLAIN SELECT a FROM t1 ORDER BY a, BINARY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 67 NULL 96 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 67 NULL 96 Using index; Using filesort SELECT a FROM t1 ORDER BY a, BINARY a; a -a @@ -15035,8 +15035,8 @@ vice-versa # Descending sort, using filesort # EXPLAIN SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 67 NULL 96 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 67 NULL 96 Using index; Using filesort SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; a ฯพณฯ @@ -15139,8 +15139,8 @@ A # Ascending sort, using index # EXPLAIN SELECT a FROM t1 ORDER BY a, id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 67 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 67 NULL 96 Using index SELECT a FROM t1 ORDER BY a, id; a -a @@ -15243,8 +15243,8 @@ vice-versa # Descending sort, using index # EXPLAIN SELECT a FROM t1 ORDER BY a DESC, id DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 67 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 67 NULL 96 Using index SELECT a FROM t1 ORDER BY a DESC, id DESC; a ฯพณฯ diff --git a/mysql-test/main/ctype_uca_innodb.result b/mysql-test/main/ctype_uca_innodb.result index 2f46a140c83..f65bce6453a 100644 --- a/mysql-test/main/ctype_uca_innodb.result +++ b/mysql-test/main/ctype_uca_innodb.result @@ -24,8 +24,8 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; @@ -43,14 +43,14 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; ch EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; @@ -93,8 +93,8 @@ aЀ aր EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -116,8 +116,8 @@ aЀ aր EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; ch a @@ -145,15 +145,15 @@ ch z EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ch z EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; ch z diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result index 6c14ca3ab66..e8f03f440a7 100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@ -255,11 +255,11 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); explain select * from t1 where a like 'abc%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 23 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 23 NULL 2 Using where; Using index explain select * from t1 where a like concat('abc','%'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 23 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 23 NULL 2 Using where; Using index select * from t1 where a like "abc%"; a abc @@ -472,8 +472,8 @@ INSERT INTO t1 (word) VALUES ("aardvark"); INSERT INTO t1 (word) VALUES ("aardvara"); INSERT INTO t1 (word) VALUES ("aardvarz"); EXPLAIN SELECT * FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using filesort SELECT * FROM t1 ORDER BY word; word bar a 0 @@ -483,8 +483,8 @@ aardvara 0 aardvark 0 aardvarz 0 EXPLAIN SELECT word FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 130 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 130 NULL 6 Using index SELECT word FROM t1 ORDER by word; word a @@ -507,8 +507,8 @@ INSERT INTO t1 (word) VALUES ("aardvark"); INSERT INTO t1 (word) VALUES ("aardvara"); INSERT INTO t1 (word) VALUES ("aardvarz"); EXPLAIN SELECT * FROM t1 ORDER BY WORD; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 130 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 130 NULL 6 Using index SELECT * FROM t1 ORDER BY word; word a @@ -532,8 +532,8 @@ INSERT INTO t1 (word) VALUES ("aardvark"); INSERT INTO t1 (word) VALUES ("aardvara"); INSERT INTO t1 (word) VALUES ("aardvarz"); EXPLAIN SELECT * FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using filesort SELECT * FROM t1 ORDER BY word; word bar a 2 @@ -543,8 +543,8 @@ aardvara 5 aardvark 4 aardvarz 6 EXPLAIN SELECT word FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using filesort SELECT word FROM t1 ORDER BY word; word a @@ -1213,8 +1213,8 @@ insert into t1 values (repeat(0x201f, 10)); insert into t1 values (repeat(0x2020, 10)); insert into t1 values (repeat(0x2021, 10)); explain select hex(a) from t1 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 20 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 20 NULL 3 Using index select hex(a) from t1 order by a; hex(a) 201F201F201F201F201F201F201F201F201F201F @@ -1565,11 +1565,11 @@ INSERT INTO t1 VALUES INSERT INTO t1 VALUES ('ca'),('cz'),('ch'); INSERT INTO t1 VALUES ('da'),('dz'), (X'0064017E'); EXPLAIN SELECT * FROM t1 WHERE a LIKE 'b%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 23 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 23 NULL 1 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a LIKE 'c%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 23 NULL 31 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 23 NULL 31 Using where; Using index SELECT * FROM t1 WHERE a LIKE 'c%'; a ca @@ -1577,21 +1577,21 @@ cc cz ch EXPLAIN SELECT * FROM t1 WHERE a LIKE 'ch%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 23 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 23 NULL 1 Using where; Using index SELECT * FROM t1 WHERE a LIKE 'ch%'; a ch ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_ci; EXPLAIN SELECT * FROM t1 WHERE a LIKE 'd%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 23 NULL 31 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 23 NULL 31 Using where; Using index SELECT hex(concat('d',_ucs2 0x017E,'%')); hex(concat('d',_ucs2 0x017E,'%')) 0064017E0025 EXPLAIN SELECT * FROM t1 WHERE a LIKE concat('d',_ucs2 0x017E,'%'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 23 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 23 NULL 1 Using where; Using index SELECT hex(a) FROM t1 WHERE a LIKE concat('D',_ucs2 0x017E,'%'); hex(a) 0064017E @@ -4369,12 +4369,12 @@ date_column DATE DEFAULT NULL, KEY(date_column)); INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01'); EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 4 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range date_column date_column 4 NULL 2 Using index condition ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL; EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 6 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range date_column date_column 6 NULL 2 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data @@ -4471,12 +4471,12 @@ END// CALL p1; v_LastPaymentDate < NOW() NULL -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()` -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select concat(convert(v_LastPaymentDate@0 using ucs2),convert(current_timestamp() using ucs2)) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; @@ -5453,8 +5453,8 @@ SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; @@ -5476,8 +5476,8 @@ SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -5499,8 +5499,8 @@ SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -5522,8 +5522,8 @@ SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -5544,8 +5544,8 @@ SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; a LENGTH(a) a 2 EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; @@ -5574,8 +5574,8 @@ SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; @@ -5597,8 +5597,8 @@ SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -5620,8 +5620,8 @@ SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -5643,8 +5643,8 @@ SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -5665,8 +5665,8 @@ SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; a LENGTH(a) a 2 EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; @@ -5753,8 +5753,8 @@ CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10)); INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3'); EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(c,0)='3 ' AND COALESCE(d,0)=COALESCE(c,0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where coalesce(`test`.`t1`.`c`,0) = '3 ' and coalesce(`test`.`t1`.`d`,0) = '3 ' DROP TABLE t1; diff --git a/mysql-test/main/ctype_utf16.result b/mysql-test/main/ctype_utf16.result index 36dedc87321..e3a5dfb2225 100644 --- a/mysql-test/main/ctype_utf16.result +++ b/mysql-test/main/ctype_utf16.result @@ -132,11 +132,11 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); explain select * from t1 where a like 'abc%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 43 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 43 NULL 2 Using where; Using index explain select * from t1 where a like concat('abc','%'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 43 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 43 NULL 2 Using where; Using index select * from t1 where a like "abc%"; a abc @@ -351,8 +351,8 @@ INSERT INTO t1 (word) VALUES ("aardvark"); INSERT INTO t1 (word) VALUES ("aardvara"); INSERT INTO t1 (word) VALUES ("aardvarz"); EXPLAIN SELECT * FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using filesort SELECT * FROM t1 ORDER BY word; word bar a 0 @@ -362,8 +362,8 @@ aardvara 0 aardvark 0 aardvarz 0 EXPLAIN SELECT word FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 258 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 Using index SELECT word FROM t1 ORDER by word; word a @@ -386,8 +386,8 @@ INSERT INTO t1 (word) VALUES ("aardvark"); INSERT INTO t1 (word) VALUES ("aardvara"); INSERT INTO t1 (word) VALUES ("aardvarz"); EXPLAIN SELECT * FROM t1 ORDER BY WORD; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 258 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 Using index SELECT * FROM t1 ORDER BY word; word a @@ -411,8 +411,8 @@ INSERT INTO t1 (word) VALUES ("aardvark"); INSERT INTO t1 (word) VALUES ("aardvara"); INSERT INTO t1 (word) VALUES ("aardvarz"); EXPLAIN SELECT * FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using filesort SELECT * FROM t1 ORDER BY word; word bar a 2 @@ -422,8 +422,8 @@ aardvara 5 aardvark 4 aardvarz 6 EXPLAIN SELECT word FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using filesort SELECT word FROM t1 ORDER BY word; word a @@ -882,8 +882,8 @@ insert into t1 values (repeat(0x201f, 10)); insert into t1 values (repeat(0x2020, 10)); insert into t1 values (repeat(0x2021, 10)); explain select hex(a) from t1 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 40 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 40 NULL 3 Using index select hex(a) from t1 order by a; hex(a) 201F201F201F201F201F201F201F201F201F201F diff --git a/mysql-test/main/ctype_utf16_uca.result b/mysql-test/main/ctype_utf16_uca.result index d1dbd498064..f1dfea3d5b4 100644 --- a/mysql-test/main/ctype_utf16_uca.result +++ b/mysql-test/main/ctype_utf16_uca.result @@ -4004,8 +4004,8 @@ D801DC00 30D2 𐐀 D801DC28 30D2 𐐨 ALTER TABLE t1 ADD KEY(c); EXPLAIN SELECT hex(c) FROM t1 WHERE c LIKE 'a%' ORDER BY c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 43 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c c 43 NULL 3 Using where; Using index SELECT hex(c), hex(weight_string(c)) FROM t1 WHERE c LIKE 'a%' ORDER BY c; hex(c) hex(weight_string(c)) 0061 120F @@ -6892,8 +6892,8 @@ t1 CREATE TABLE `t1` ( # Ascending sort, using filesort # EXPLAIN SELECT a FROM t1 ORDER BY a, BINARY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index; Using filesort SELECT a FROM t1 ORDER BY a, BINARY a; a -a @@ -6996,8 +6996,8 @@ vice-versa # Descending sort, using filesort # EXPLAIN SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index; Using filesort SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; a ฯพณฯ @@ -7100,8 +7100,8 @@ A # Ascending sort, using index # EXPLAIN SELECT a FROM t1 ORDER BY a, id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index SELECT a FROM t1 ORDER BY a, id; a -a @@ -7204,8 +7204,8 @@ vice-versa # Descending sort, using index # EXPLAIN SELECT a FROM t1 ORDER BY a DESC, id DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index SELECT a FROM t1 ORDER BY a DESC, id DESC; a ฯพณฯ diff --git a/mysql-test/main/ctype_utf16le.result b/mysql-test/main/ctype_utf16le.result index aff755d95ae..cdc75a11385 100644 --- a/mysql-test/main/ctype_utf16le.result +++ b/mysql-test/main/ctype_utf16le.result @@ -135,11 +135,11 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); explain select * from t1 where a like 'abc%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 43 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 43 NULL 2 Using where; Using index explain select * from t1 where a like concat('abc','%'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 43 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 43 NULL 2 Using where; Using index select * from t1 where a like "abc%"; a abc @@ -367,8 +367,8 @@ INSERT INTO t1 (word) VALUES ("aardvark"); INSERT INTO t1 (word) VALUES ("aardvara"); INSERT INTO t1 (word) VALUES ("aardvarz"); EXPLAIN SELECT * FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using filesort SELECT * FROM t1 ORDER BY word; word bar a 0 @@ -378,8 +378,8 @@ aardvara 0 aardvark 0 aardvarz 0 EXPLAIN SELECT word FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 258 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 Using index SELECT word FROM t1 ORDER by word; word a @@ -405,8 +405,8 @@ INSERT INTO t1 (word) VALUES ("aardvark"); INSERT INTO t1 (word) VALUES ("aardvara"); INSERT INTO t1 (word) VALUES ("aardvarz"); EXPLAIN SELECT * FROM t1 ORDER BY WORD; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 258 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 Using index SELECT * FROM t1 ORDER BY word; word a @@ -433,8 +433,8 @@ INSERT INTO t1 (word) VALUES ("aardvark"); INSERT INTO t1 (word) VALUES ("aardvara"); INSERT INTO t1 (word) VALUES ("aardvarz"); EXPLAIN SELECT * FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using filesort SELECT * FROM t1 ORDER BY word; word bar a 2 @@ -444,8 +444,8 @@ aardvara 5 aardvark 4 aardvarz 6 EXPLAIN SELECT word FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using filesort SELECT word FROM t1 ORDER BY word; word a @@ -927,8 +927,8 @@ INSERT INTO t1 VALUES (REPEAT(_ucs2 0x2020, 10)); INSERT INTO t1 VALUES (REPEAT(_ucs2 0x2021, 10)); # make sure "index read" is used explain SELECT HEX(a) FROM t1 ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 40 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 40 NULL 3 Using index SELECT HEX(a) FROM t1 ORDER BY a; HEX(a) 1F201F201F201F201F201F201F201F201F201F20 diff --git a/mysql-test/main/ctype_utf32.result b/mysql-test/main/ctype_utf32.result index d7717ece210..ae0c77a82df 100644 --- a/mysql-test/main/ctype_utf32.result +++ b/mysql-test/main/ctype_utf32.result @@ -131,11 +131,11 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); explain select * from t1 where a like 'abc%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 43 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 43 NULL 2 Using where; Using index explain select * from t1 where a like concat('abc','%'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 43 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 43 NULL 2 Using where; Using index select * from t1 where a like "abc%"; a abc @@ -350,8 +350,8 @@ INSERT INTO t1 (word) VALUES ("aardvark"); INSERT INTO t1 (word) VALUES ("aardvara"); INSERT INTO t1 (word) VALUES ("aardvarz"); EXPLAIN SELECT * FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using filesort SELECT * FROM t1 ORDER BY word; word bar a 0 @@ -361,8 +361,8 @@ aardvara 0 aardvark 0 aardvarz 0 EXPLAIN SELECT word FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 258 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 Using index SELECT word FROM t1 ORDER by word; word a @@ -385,8 +385,8 @@ INSERT INTO t1 (word) VALUES ("aardvark"); INSERT INTO t1 (word) VALUES ("aardvara"); INSERT INTO t1 (word) VALUES ("aardvarz"); EXPLAIN SELECT * FROM t1 ORDER BY WORD; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 258 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 Using index SELECT * FROM t1 ORDER BY word; word a @@ -410,8 +410,8 @@ INSERT INTO t1 (word) VALUES ("aardvark"); INSERT INTO t1 (word) VALUES ("aardvara"); INSERT INTO t1 (word) VALUES ("aardvarz"); EXPLAIN SELECT * FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using filesort SELECT * FROM t1 ORDER BY word; word bar a 2 @@ -421,8 +421,8 @@ aardvara 5 aardvark 4 aardvarz 6 EXPLAIN SELECT word FROM t1 ORDER BY word; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using filesort SELECT word FROM t1 ORDER BY word; word a @@ -873,8 +873,8 @@ insert into t1 values (repeat(0x0000201f, 10)); insert into t1 values (repeat(0x00002020, 10)); insert into t1 values (repeat(0x00002021, 10)); explain select hex(a) from t1 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 40 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 40 NULL 3 Using index select hex(a) from t1 order by a; hex(a) 0000201F0000201F0000201F0000201F0000201F0000201F0000201F0000201F0000201F0000201F diff --git a/mysql-test/main/ctype_utf32_uca.result b/mysql-test/main/ctype_utf32_uca.result index 32ecf49dc70..0e9c8cc65c7 100644 --- a/mysql-test/main/ctype_utf32_uca.result +++ b/mysql-test/main/ctype_utf32_uca.result @@ -4024,8 +4024,8 @@ hex(c) hex(weight_string(c)) c 00010428 30D2 𐐨 ALTER TABLE t1 ADD KEY(c); EXPLAIN SELECT hex(c) FROM t1 WHERE c LIKE 'a%' ORDER BY c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 43 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c c 43 NULL 3 Using where; Using index SELECT hex(c), hex(weight_string(c)) FROM t1 WHERE c LIKE 'a%' ORDER BY c; hex(c) hex(weight_string(c)) 00000061 120F @@ -6912,8 +6912,8 @@ t1 CREATE TABLE `t1` ( # Ascending sort, using filesort # EXPLAIN SELECT a FROM t1 ORDER BY a, BINARY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index; Using filesort SELECT a FROM t1 ORDER BY a, BINARY a; a -a @@ -7016,8 +7016,8 @@ vice-versa # Descending sort, using filesort # EXPLAIN SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index; Using filesort SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; a ฯพณฯ @@ -7120,8 +7120,8 @@ A # Ascending sort, using index # EXPLAIN SELECT a FROM t1 ORDER BY a, id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index SELECT a FROM t1 ORDER BY a, id; a -a @@ -7224,8 +7224,8 @@ vice-versa # Descending sort, using index # EXPLAIN SELECT a FROM t1 ORDER BY a DESC, id DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index SELECT a FROM t1 ORDER BY a DESC, id DESC; a ฯพณฯ diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result index 6eebc8f4cf2..ecf78cbed11 100644 --- a/mysql-test/main/ctype_utf8.result +++ b/mysql-test/main/ctype_utf8.result @@ -1690,17 +1690,17 @@ Kali Kali 2+4 Kali Kali 2+4 Kali Kali 2+4 EXPLAIN SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 40 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 40 NULL 4 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 40 const 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 40 const 4 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 14 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 14 NULL 4 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 14 const 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref a a 14 const 4 Using where; Using index DROP TABLE t1,t2; CREATE TABLE t1 ( a char(255) DEFAULT '', @@ -1791,14 +1791,14 @@ create table t1(a char(200) collate utf8_unicode_ci NOT NULL default '') default charset=utf8 collate=utf8_unicode_ci; insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65')); explain select distinct a from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary select distinct a from t1; a e explain select a from t1 group by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary; Using filesort select a from t1 group by a; a e @@ -1807,9 +1807,9 @@ create table t1(a char(10)) default charset utf8; insert into t1 values ('123'), ('456'); explain select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Y ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -1 SIMPLE Z ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Y NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE Z NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; substr(Z.a,-1) a 3 123 @@ -1836,8 +1836,8 @@ crash 37 INSERT INTO crashtest VALUES ('-1000'); EXPLAIN SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE crashtest ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 Using filesort SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8); crash -1000 @@ -5236,12 +5236,12 @@ date_column DATE DEFAULT NULL, KEY(date_column)); INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01'); EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 4 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range date_column date_column 4 NULL 2 Using index condition ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL; EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range date_column date_column 6 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range date_column date_column 6 NULL 2 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data @@ -5338,12 +5338,12 @@ END// CALL p1; v_LastPaymentDate < NOW() NULL -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()` -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select concat(convert(v_LastPaymentDate@0 using utf8mb3),current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; @@ -5413,15 +5413,15 @@ DROP TABLE t1; # # as in the bug report. EXPLAIN output should still be pretty readable SET NAMES latin1; EXPLAIN EXTENDED SELECT 'abcdÁÂÃÄÅ', _latin1'abcdÁÂÃÄÅ', _utf8'abcdÁÂÃÄÅ' AS u; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 'abcd�\0081ÂÃÄÅ' AS `abcd�\0081ÂÃÄÅ`,_latin1'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcd�\0081ÂÃÄÅ`,_utf8mb3'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `u` # Test normal utf8 SET NAMES utf8; EXPLAIN EXTENDED SELECT 'abcdÁÂÃÄÅ', _latin1'abcdÁÂÃÄÅ', _utf8'abcdÁÂÃÄÅ'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 'abcdÁÂÃÄÅ' AS `abcdÁÂÃÄÅ`,_latin1'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÃ\0081ÂÃÄÅ`,_utf8mb3'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÁÂÃÄÅ` # @@ -5473,8 +5473,8 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; @@ -5492,14 +5492,14 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; ch EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; @@ -5542,8 +5542,8 @@ aЀ aր EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -5565,8 +5565,8 @@ aЀ aր EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; ch a @@ -5594,15 +5594,15 @@ ch z EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ch z EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; ch z @@ -5692,8 +5692,8 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; @@ -5711,14 +5711,14 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; ch EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; @@ -5761,8 +5761,8 @@ aЀ aր EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -5784,8 +5784,8 @@ aЀ aր EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; ch a @@ -5813,15 +5813,15 @@ ch z EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ch z EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; ch z @@ -5911,8 +5911,8 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch EXPLAIN SELECT ch FROM t1 WHERE ch='admin𝌆'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; @@ -5930,14 +5930,14 @@ SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; ch EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; @@ -5980,8 +5980,8 @@ aЀ aր EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -6003,8 +6003,8 @@ aЀ aր EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; ch a @@ -6032,15 +6032,15 @@ ch z EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ch z EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; ch z @@ -6808,8 +6808,8 @@ SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; @@ -6831,8 +6831,8 @@ SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -6854,8 +6854,8 @@ SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -6877,8 +6877,8 @@ SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -6899,8 +6899,8 @@ SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; a LENGTH(a) a 1 EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' DROP TABLE t1; @@ -6929,8 +6929,8 @@ SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' DROP TABLE t1; @@ -6952,8 +6952,8 @@ SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); c1 a EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -6975,8 +6975,8 @@ SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -6998,8 +6998,8 @@ SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); c1 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) DROP TABLE t1; @@ -7020,8 +7020,8 @@ SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; a LENGTH(a) a 1 EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a' DROP TABLE t1; @@ -7047,8 +7047,8 @@ ae SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; c1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` = 'ä' and `test`.`t1`.`c1` like 'ae' SELECT * FROM t1 WHERE CONCAT(c1)='ä'; @@ -7060,8 +7060,8 @@ ae SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'; c1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'ä' and concat(`test`.`t1`.`c1`) like 'ae' DROP TABLE IF EXISTS t1; @@ -7099,12 +7099,12 @@ INSERT INTO t1 (a) VALUES ('a'),('b'),('c'),('d'),('¢'); SET @arg='¢'; PREPARE stmt FROM "EXPLAIN SELECT * FROM t1 WHERE a BETWEEN _utf8'¢' and ?"; EXECUTE stmt USING @arg; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 33 NULL 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 33 NULL 1 Using index condition PREPARE stmt FROM "EXPLAIN SELECT * FROM t1 WHERE a between ? and _utf8'¢'"; EXECUTE stmt USING @arg; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 33 NULL 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 33 NULL 1 Using index condition DEALLOCATE PREPARE stmt; DROP TABLE t1; # @@ -7116,12 +7116,12 @@ INSERT INTO t1 (a) VALUES ('a'),('b'),('c'),('d'),('¢'); SET @arg='¢'; PREPARE stmt FROM "EXPLAIN SELECT * FROM t1 WHERE a BETWEEN _utf8'¢' and ?"; EXECUTE stmt USING @arg; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 13 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 13 const 1 Using index condition PREPARE stmt FROM "EXPLAIN SELECT * FROM t1 WHERE a between ? and _utf8'¢'"; EXECUTE stmt USING @arg; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 13 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 13 const 1 Using index condition DEALLOCATE PREPARE stmt; DROP TABLE t1; # @@ -10307,8 +10307,8 @@ a Warnings: Warning 1292 Truncated incorrect DOUBLE value: '1é1' EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,a)=(10,'1e1'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 10 and `test`.`t1`.`a` = '1e1' DROP TABLE t1; @@ -10334,13 +10334,13 @@ a Warnings: Warning 1292 Truncated incorrect DOUBLE value: '1ë1' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '1ë1' and `test`.`t1`.`a` in (1,2) EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '1ë1' and `test`.`t1`.`a` in (1,2,'x') DROP TABLE IF EXISTS t1; @@ -10354,8 +10354,8 @@ c A EXPLAIN EXTENDED SELECT * FROM t1 WHERE c>=_utf8'a' COLLATE utf8_general_ci AND c='A'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`c` = 'A' DROP TABLE t1; diff --git a/mysql-test/main/ctype_utf8mb4.result b/mysql-test/main/ctype_utf8mb4.result index 97d28f6b765..5224406ac5c 100644 --- a/mysql-test/main/ctype_utf8mb4.result +++ b/mysql-test/main/ctype_utf8mb4.result @@ -1715,17 +1715,17 @@ Kali Kali 2+4 Kali Kali 2+4 Kali Kali 2+4 EXPLAIN SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 53 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 53 NULL 4 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 53 const 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 53 const 4 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 14 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 14 NULL 4 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 14 const 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref a a 14 const 4 Using where; Using index DROP TABLE t1,t2; CREATE TABLE t1 ( a char(255) DEFAULT '', @@ -1816,14 +1816,14 @@ create table t1(a char(200) collate utf8mb4_unicode_ci NOT NULL default '') default charset=utf8mb4 collate=utf8mb4_unicode_ci; insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65')); explain select distinct a from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary select distinct a from t1; a e explain select a from t1 group by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary; Using filesort select a from t1 group by a; a e @@ -1832,9 +1832,9 @@ create table t1(a char(10)) default charset utf8mb4; insert into t1 values ('123'), ('456'); explain select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Y ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -1 SIMPLE Z ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Y NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE Z NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; substr(Z.a,-1) a 3 123 @@ -1862,8 +1862,8 @@ crash 37 INSERT INTO crashtest VALUES ('-1000'); EXPLAIN SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE crashtest ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 Using filesort SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4); crash -1000 diff --git a/mysql-test/main/ctype_utf8mb4_heap.result b/mysql-test/main/ctype_utf8mb4_heap.result index 83ae28929a6..c13c69c3e45 100644 --- a/mysql-test/main/ctype_utf8mb4_heap.result +++ b/mysql-test/main/ctype_utf8mb4_heap.result @@ -1602,17 +1602,17 @@ Kali Kali 2+4 Kali Kali 2+4 Kali Kali 2+4 EXPLAIN SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a NULL NULL NULL 12 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 12 Using where EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 53 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 53 const 4 Using where EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL a NULL NULL NULL 12 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 12 Using where EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 14 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref a a 14 const 4 Using where DROP TABLE t1,t2; CREATE TABLE t1 ( a char(255) DEFAULT '', @@ -1648,14 +1648,14 @@ create table t1(a char(200) collate utf8mb4_unicode_ci NOT NULL default '') default charset=utf8mb4 collate=utf8mb4_unicode_ci engine heap; insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65')); explain select distinct a from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary SELECT COUNT(*) FROM (SELECT DISTINCT a FROM t1) AS t2; COUNT(*) 1 explain select a from t1 group by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary; Using filesort SELECT COUNT(*) FROM (SELECT a FROM t1 GROUP BY a) AS t2; COUNT(*) 1 @@ -1664,9 +1664,9 @@ create table t1(a char(10)) default charset utf8mb4 engine heap; insert into t1 values ('123'), ('456'); explain select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Y ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -1 SIMPLE Z ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Y NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE Z NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; substr(Z.a,-1) a 3 123 @@ -1694,8 +1694,8 @@ crash 37 INSERT INTO crashtest VALUES ('-1000'); EXPLAIN SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE crashtest ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 Using filesort SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4); crash -1000 diff --git a/mysql-test/main/ctype_utf8mb4_innodb.result b/mysql-test/main/ctype_utf8mb4_innodb.result index e7a64101cfc..3a7f4c11beb 100644 --- a/mysql-test/main/ctype_utf8mb4_innodb.result +++ b/mysql-test/main/ctype_utf8mb4_innodb.result @@ -1673,17 +1673,17 @@ Kali Kali 2+4 Kali Kali 2+4 Kali Kali 2+4 EXPLAIN SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 53 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 53 NULL 4 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 53 const 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 53 const 4 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 14 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 14 NULL 4 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 14 const 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref a a 14 const 4 Using where; Using index DROP TABLE t1,t2; CREATE TABLE t1 ( a char(255) DEFAULT '', @@ -1774,14 +1774,14 @@ create table t1(a char(200) collate utf8mb4_unicode_ci NOT NULL default '') default charset=utf8mb4 collate=utf8mb4_unicode_ci engine InnoDB; insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65')); explain select distinct a from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary SELECT COUNT(*) FROM (SELECT DISTINCT a FROM t1) AS t2; COUNT(*) 1 explain select a from t1 group by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary; Using filesort SELECT COUNT(*) FROM (SELECT a FROM t1 GROUP BY a) AS t2; COUNT(*) 1 @@ -1790,9 +1790,9 @@ create table t1(a char(10)) default charset utf8mb4 engine InnoDB; insert into t1 values ('123'), ('456'); explain select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Y ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -1 SIMPLE Z ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Y NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE Z NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; substr(Z.a,-1) a 3 123 @@ -1820,8 +1820,8 @@ crash 37 INSERT INTO crashtest VALUES ('-1000'); EXPLAIN SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE crashtest ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 Using filesort SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4); crash -1000 diff --git a/mysql-test/main/ctype_utf8mb4_myisam.result b/mysql-test/main/ctype_utf8mb4_myisam.result index 2360b828b9a..ba4c2c53dd7 100644 --- a/mysql-test/main/ctype_utf8mb4_myisam.result +++ b/mysql-test/main/ctype_utf8mb4_myisam.result @@ -1680,17 +1680,17 @@ Kali Kali 2+4 Kali Kali 2+4 Kali Kali 2+4 EXPLAIN SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 53 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 53 NULL 4 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 53 const 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 53 const 4 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 14 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 14 NULL 4 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 14 const 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref a a 14 const 4 Using where; Using index DROP TABLE t1,t2; CREATE TABLE t1 ( a char(255) DEFAULT '', @@ -1781,14 +1781,14 @@ create table t1(a char(200) collate utf8mb4_unicode_ci NOT NULL default '') default charset=utf8mb4 collate=utf8mb4_unicode_ci engine MyISAM; insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65')); explain select distinct a from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary SELECT COUNT(*) FROM (SELECT DISTINCT a FROM t1) AS t2; COUNT(*) 1 explain select a from t1 group by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary; Using filesort SELECT COUNT(*) FROM (SELECT a FROM t1 GROUP BY a) AS t2; COUNT(*) 1 @@ -1797,9 +1797,9 @@ create table t1(a char(10)) default charset utf8mb4 engine MyISAM; insert into t1 values ('123'), ('456'); explain select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Y ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -1 SIMPLE Z ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Y NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE Z NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; substr(Z.a,-1) a 3 123 @@ -1827,8 +1827,8 @@ crash 37 INSERT INTO crashtest VALUES ('-1000'); EXPLAIN SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE crashtest ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 Using filesort SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4); crash -1000 diff --git a/mysql-test/main/ctype_utf8mb4_uca.result b/mysql-test/main/ctype_utf8mb4_uca.result index 34cc443e6f6..abeba159010 100644 --- a/mysql-test/main/ctype_utf8mb4_uca.result +++ b/mysql-test/main/ctype_utf8mb4_uca.result @@ -5596,8 +5596,8 @@ t1 CREATE TABLE `t1` ( # Ascending sort, using filesort # EXPLAIN SELECT a FROM t1 ORDER BY a, BINARY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index; Using filesort SELECT a FROM t1 ORDER BY a, BINARY a; a -a @@ -5700,8 +5700,8 @@ vice-versa # Descending sort, using filesort # EXPLAIN SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index; Using filesort SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; a ฯพณฯ @@ -5804,8 +5804,8 @@ A # Ascending sort, using index # EXPLAIN SELECT a FROM t1 ORDER BY a, id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index SELECT a FROM t1 ORDER BY a, id; a -a @@ -5908,8 +5908,8 @@ vice-versa # Descending sort, using index # EXPLAIN SELECT a FROM t1 ORDER BY a DESC, id DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a_id 127 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index SELECT a FROM t1 ORDER BY a DESC, id DESC; a ฯพณฯ diff --git a/mysql-test/main/custom_aggregates_i_s.result b/mysql-test/main/custom_aggregates_i_s.result index cb98aee389d..51bf39a0b12 100644 --- a/mysql-test/main/custom_aggregates_i_s.result +++ b/mysql-test/main/custom_aggregates_i_s.result @@ -37,43 +37,43 @@ Feature_custom_aggregate_functions 1 subqueries with custom aggregates explain select * from t1, (select f1(sal) as a from t1 where id>= 1) q where q.a=t1.sal; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.sal 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.sal 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 Using where show status like "%custom_aggregate%"; Variable_name Value Feature_custom_aggregate_functions 2 explain select * from t1, (select sal as a from t1 where (select f1(t3.sal) from t3) >=-1 ) q where q.a=t1.sal; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t3 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 4 show status like "%custom_aggregate%"; Variable_name Value Feature_custom_aggregate_functions 3 explain select (select f1(sal) as a from t3 where t3.id= t1.id ) from t1 ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 4 Using where show status like "%custom_aggregate%"; Variable_name Value Feature_custom_aggregate_functions 4 explain select (select f1(sal) as a from t3 where t3.id= t1.id ) from t1 ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 4 Using where show status like "%custom_aggregate%"; Variable_name Value Feature_custom_aggregate_functions 5 custom aggregates inside other customm aggregates explain select f2(sal) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 show status like "%custom_aggregate%"; Variable_name Value Feature_custom_aggregate_functions 6 diff --git a/mysql-test/main/date_formats.result b/mysql-test/main/date_formats.result index 463cce39520..51399a41b06 100644 --- a/mysql-test/main/date_formats.result +++ b/mysql-test/main/date_formats.result @@ -386,8 +386,8 @@ NULL Warnings: Warning 1411 Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_date explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001"); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select makedate(1997,1) AS `makedate(1997,1)`,addtime('31.12.97 11.59.59.999999 PM','1 1.1.1.000002') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime('31.12.97 11.59.59.999999 PM','1 1.1.1.000002') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff('01.01.97 11:59:59.000001 PM','31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date('15-01-2001 12:59:59','%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond('1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")` create table t1 (d date); diff --git a/mysql-test/main/default.result b/mysql-test/main/default.result index 493101f10ee..8e33f03ed1d 100644 --- a/mysql-test/main/default.result +++ b/mysql-test/main/default.result @@ -3275,8 +3275,8 @@ DROP TABLE t1; # The output of this query in 'Note' is a syntactically incorrect query. # But as it's never logged, it's ok. It should be human readable only. EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING IGNORE; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select ignore AS `?` CREATE TABLE t1 (a INT); diff --git a/mysql-test/main/delete.result b/mysql-test/main/delete.result index ed3683d52f9..dd03009ae93 100644 --- a/mysql-test/main/delete.result +++ b/mysql-test/main/delete.result @@ -208,10 +208,10 @@ a b a b a b 2 1 2 2 2 1 1 3 1 1 1 3 explain select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 Using index -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b,test.t1.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a 1 Using index +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 8 test.t2.b,test.t1.b 1 Using index delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b; select * from t3; a b diff --git a/mysql-test/main/delete_innodb.result b/mysql-test/main/delete_innodb.result index b9f4c8bdaf5..5ea61364228 100644 --- a/mysql-test/main/delete_innodb.result +++ b/mysql-test/main/delete_innodb.result @@ -16,9 +16,9 @@ c1 a b EXPLAIN DELETE b FROM t1 AS a JOIN t1 AS b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE a index NULL PRIMARY 255 NULL 3 Using index -1 SIMPLE b ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE a NULL index NULL PRIMARY 255 NULL 3 Using index +1 SIMPLE b NULL ALL NULL NULL NULL NULL 3 DELETE b FROM t1 AS a JOIN t1 AS b; SELECT * FROM t1; c1 diff --git a/mysql-test/main/delete_use_source.test b/mysql-test/main/delete_use_source.test index 4aed00da375..9abf621f09f 100644 --- a/mysql-test/main/delete_use_source.test +++ b/mysql-test/main/delete_use_source.test @@ -64,7 +64,7 @@ rollback; --echo # start transaction; ---replace_column 9 # +--replace_column 10 # explain delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500; --enable_info ONCE delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 ; diff --git a/mysql-test/main/derived.result b/mysql-test/main/derived.result index b6310f1a09f..51fdd66ac55 100644 --- a/mysql-test/main/derived.result +++ b/mysql-test/main/derived.result @@ -58,10 +58,10 @@ a b a b 3 c 3 c 3 c 3 c explain select * from t1 as x1, (select * from t1) as x2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY x1 ALL NULL NULL NULL NULL 4 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY x1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 4 drop table if exists t2,t3; select * from (select 1) as a; 1 @@ -92,16 +92,16 @@ a b 1 a 2 b explain select * from (select * from t1 union select * from t1) a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8 -2 DERIVED t1 ALL NULL NULL NULL NULL 4 -3 UNION t1 ALL NULL NULL NULL NULL 4 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 8 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 4 +3 UNION t1 NULL ALL NULL NULL NULL NULL 4 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain select * from (select * from t1 union all select * from t1) a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8 -2 DERIVED t1 ALL NULL NULL NULL NULL 4 -3 UNION t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 8 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 4 +3 UNION t1 NULL ALL NULL NULL NULL NULL 4 CREATE TABLE t2 (a int not null); insert into t2 values(1); select * from (select * from t1 where t1.a=(select a from t2 where t2.a=t1.a)) a; @@ -113,10 +113,10 @@ a b 2 b 3 c explain select * from (select t1.*, t2.a as t2a from t1,t2 where t1.a=t2.a) t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 -2 DERIVED t2 system NULL NULL NULL NULL 1 -2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 +2 DERIVED t2 NULL system NULL NULL NULL NULL 1 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 4 Using where drop table t1, t2; create table t1(a int not null, t char(8), index(a)); SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20; @@ -142,10 +142,10 @@ a t 19 19 20 20 explain select count(*) from t1 as tt1, (select * from t1) as tt2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY tt1 index NULL a 4 NULL 10000 Using index -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 10000 Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 10000 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY tt1 NULL index NULL a 4 NULL 10000 Using index +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 10000 Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 10000 drop table t1; SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b; (SELECT * FROM (SELECT 1 as a) as a ) @@ -164,9 +164,9 @@ ERROR 42S22: Unknown column '0' in 'order clause' create table t1 (id int); insert into t1 values (1),(2),(3); describe select * from (select * from t1 group by id) bar; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 -2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 Using temporary; Using filesort drop table t1; create table t1 (mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, matintnum CHAR(6) NOT NULL, test MEDIUMINT UNSIGNED NULL); create table t2 (mat_id MEDIUMINT UNSIGNED NOT NULL, pla_id MEDIUMINT UNSIGNED NOT NULL); @@ -189,17 +189,17 @@ pla_id test 104 2 105 3 explain SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY m2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 9 Using where; Using join buffer (flat, BNL join) -2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort -2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY m2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 9 Using where; Using join buffer (flat, BNL join) +2 DERIVED mp NULL ALL NULL NULL NULL NULL 9 Using temporary; Using filesort +2 DERIVED m1 NULL eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 explain SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY m2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 9 Using where; Using join buffer (flat, BNL join) -2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort -2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY m2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 9 Using where; Using join buffer (flat, BNL join) +2 DERIVED mp NULL ALL NULL NULL NULL NULL 9 Using temporary; Using filesort +2 DERIVED m1 NULL eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 drop table t1,t2; SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1; x @@ -234,11 +234,11 @@ select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A count(*) 2 explain select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 THEMAX.E2 1 Using where -2 DERIVED A ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 THEMAX.E2 1 Using where +2 DERIVED A NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 2 Using where drop table t1; create table t1 (a int); insert into t1 values (1),(2); @@ -249,15 +249,15 @@ a a 1 2 2 2 explain select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 -1 PRIMARY <derived4> ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) -4 DERIVED t1 ALL NULL NULL NULL NULL 2 -5 UNION t1 ALL NULL NULL NULL NULL 2 -NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL -2 DERIVED t1 ALL NULL NULL NULL NULL 2 -3 UNION t1 ALL NULL NULL NULL NULL 2 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 +5 UNION t1 NULL ALL NULL NULL NULL NULL 2 +NULL UNION RESULT <union4,5> NULL ALL NULL NULL NULL NULL NULL +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 +3 UNION t1 NULL ALL NULL NULL NULL NULL 2 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL drop table t1; CREATE TABLE `t1` ( `N` int(11) unsigned NOT NULL default '0', @@ -315,20 +315,20 @@ name median a 7.0000 b 3.5000 explain SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 289 Using temporary; Using filesort -2 DERIVED x ALL NULL NULL NULL NULL 17 Using temporary; Using filesort -2 DERIVED y ALL NULL NULL NULL NULL 17 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 289 Using temporary; Using filesort +2 DERIVED x NULL ALL NULL NULL NULL NULL 17 Using temporary; Using filesort +2 DERIVED y NULL ALL NULL NULL NULL NULL 17 Using where; Using join buffer (flat, BNL join) drop table t1; create table t2 (a int, b int, primary key (a)); insert into t2 values (1,7),(2,7); explain select a from t2 where a>1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using where; Using index explain select a from (select a from t2 where a>1) tt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED t2 range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using where; Using index drop table t2; CREATE TABLE `t1` ( `itemid` int(11) NOT NULL default '0', `grpid` varchar(15) NOT NULL default '', `vendor` int(11) NOT NULL default '0', `date_` date NOT NULL default '0000-00-00', `price` decimal(12,2) NOT NULL default '0.00', PRIMARY KEY (`itemid`,`grpid`,`vendor`,`date_`), KEY `itemid` (`itemid`,`vendor`), KEY `itemid_2` (`itemid`,`date_`)); insert into t1 values (128, 'rozn', 2, curdate(), 10), @@ -518,14 +518,14 @@ CREATE algorithm=temptable VIEW v1 AS SELECT 1 FROM t1 LEFT JOIN t1 t3 ON 1 > (SELECT 1 FROM t1); CREATE algorithm=temptable VIEW v2 AS SELECT 1 FROM t2; EXPLAIN SELECT 1 FROM t1 JOIN v1 ON 1 > (SELECT 1 FROM v2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) -3 DERIVED t1 ALL NULL NULL NULL NULL 2 -3 DERIVED t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -4 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY <derived5> ALL NULL NULL NULL NULL 2 -5 DERIVED t2 index NULL b 5 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 +3 DERIVED t3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +4 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY <derived5> NULL ALL NULL NULL NULL NULL 2 +5 DERIVED t2 NULL index NULL b 5 NULL 2 Using index SELECT 1 FROM t1 JOIN v1 ON 1 > (SELECT 1 FROM v2); ERROR 21000: Subquery returns more than 1 row DROP TABLE t1, t2; @@ -551,10 +551,10 @@ CREATE TABLE t2 (b INT) ENGINE=MyISAM; INSERT INTO t2 VALUES (1),(7); EXPLAIN SELECT * FROM (SELECT * FROM t1) AS table1, (SELECT DISTINCT * FROM t2) AS table2 WHERE b = a AND a <> ANY (SELECT 9); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY <derived3> ref key0 key0 5 const 0 -3 DERIVED t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY <derived3> NULL ref key0 key0 5 const 0 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using temporary Warnings: Note 1249 Select 4 was reduced during optimization DROP TABLE t1, t2; @@ -611,11 +611,11 @@ explain extended select x.id, message from (select id from t1) x left join (select id, 1 as message from t2) y on x.id=y.id where message <> 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -3 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `x`.`id` AS `id`,`y`.`message` AS `message` from (/* select#2 */ select `test`.`t1`.`id` AS `id` from `test`.`t1`) `x` join (/* select#3 */ select `test`.`t2`.`id` AS `id`,1 AS `message` from `test`.`t2`) `y` where `y`.`id` = `x`.`id` and `y`.`message` <> 0 drop table t1,t2; @@ -635,12 +635,12 @@ SELECT f3 FROM t2 WHERE f2 IN ( SELECT f3 FROM t2 HAVING f3 >= 8 ) ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00 -1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 const 1 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(<subquery4>); Using join buffer (flat, BNL join) -4 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY <subquery4> NULL eq_ref distinct_key distinct_key 4 const 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(<subquery4>); Using join buffer (flat, BNL join) +4 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1276 Field or reference 'sq.f2' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select 6 AS `f1` from <materialize> (/* select#4 */ select `test`.`t2`.`f3` from `test`.`t2` having `test`.`t2`.`f3` >= 8) semi join (`test`.`t2`) where `<subquery4>`.`f3` = 9 and `test`.`t2`.`f3` = 6 @@ -906,63 +906,63 @@ FROM `t2` WHERE REF IS NULL AND DIVISION="MIS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS C1 ON A.CLIENT_NUMBER=C1.CLIENT_NUMBER AND A.DIVISION=C1.DIVISION AND A.RECEIVABLE_GROUP=C1.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=C1.CREDIT_LIMIT ORDER BY TOTAL DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived3> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived4> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived5> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived6> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived7> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived8> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived9> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived10> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived11> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived12> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived13> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived14> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived15> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived16> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived17> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived18> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived19> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived20> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived21> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived22> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived23> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived24> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived25> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived26> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived27> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived28> system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <derived29> system NULL NULL NULL NULL 0 Const row not found -29 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -28 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -27 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -26 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -25 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -24 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -23 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -22 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -21 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -20 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -19 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -18 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -17 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -16 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -15 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -14 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -13 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -12 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -11 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -10 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -9 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -8 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -7 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -5 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -4 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived3> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived4> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived5> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived6> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived7> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived8> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived9> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived10> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived11> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived12> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived13> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived14> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived15> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived16> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived17> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived18> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived19> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived20> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived21> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived22> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived23> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived24> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived25> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived26> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived27> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived28> NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <derived29> NULL system NULL NULL NULL NULL 0 Const row not found +29 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +28 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +27 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +26 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +25 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +24 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +23 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +22 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +21 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +20 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +19 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +18 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +17 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +16 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +15 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +14 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +13 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +12 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +11 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +10 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +9 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +8 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +7 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +6 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table DROP TABLES t1,t2; set optimizer_switch=@save_derived_optimizer_switch; # @@ -1071,12 +1071,12 @@ set @save_join_cache_level= @@join_cache_level; SET join_cache_level= 8; explain SELECT * FROM v1, t2, v3 WHERE a = c AND b = d; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 1002 -1 PRIMARY <derived3> hash_ALL NULL #hash#$hj 3075 func 1002 Using where; Using join buffer (flat, BNLH join) -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 v3.d 1 Using index -3 DERIVED t3 ALL NULL NULL NULL NULL 1002 -2 DERIVED t1 ALL NULL NULL NULL NULL 1002 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 1002 +1 PRIMARY <derived3> NULL hash_ALL NULL #hash#$hj 3075 func 1002 Using where; Using join buffer (flat, BNLH join) +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 v3.d 1 Using index +3 DERIVED t3 NULL ALL NULL NULL NULL NULL 1002 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 1002 SELECT * FROM v1, t2, v3 WHERE a = c AND b = d; a b c d DROP VIEW v1, v3; @@ -1107,10 +1107,10 @@ CREATE TABLE t2 (c1 text, c2 int); INSERT INTO t2 VALUES ('b',2), ('c',3); CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; explain SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1; c1 c2 c1 c2 c 3 c 3 @@ -1118,10 +1118,10 @@ c 3 c 3 set @save_join_cache_level= @@join_cache_level; set @@join_cache_level=4; explain SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY <derived2> hash_ALL NULL #hash#$hj 3 test.t2.c1 5 Using where; Using join buffer (flat, BNLH join) -2 DERIVED t1 ALL NULL NULL NULL NULL 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived2> NULL hash_ALL NULL #hash#$hj 3 test.t2.c1 5 Using where; Using join buffer (flat, BNLH join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1; c1 c2 c1 c2 c 3 c 3 @@ -1275,24 +1275,24 @@ table "<derived2>" should have type=ref and rows=1 one select in derived table with distinct analyze select * from t1 , ((select distinct t2.a from t2 order by c))q where t1.a=q.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 1 1.00 100.00 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.a 1 1.00 100.00 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using temporary; Using filesort analyze select * from t1 , ((select distinct t2.a, t2.b from t2 order by c))q where t1.a=q.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 2 1.00 100.00 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.a 2 1.00 100.00 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using temporary; Using filesort # multiple selects in derived table # NO UNION ALL analyze select * from t1 , ( (select t2.a from t2 order by c) union (select t2.a from t2 order by c))q where t1.a=q.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 1 1.00 100.00 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 -3 UNION t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 6.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.a 1 1.00 100.00 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 +3 UNION t2 NULL ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL 6.00 NULL NULL select * from t1 , ( (select t2.a from t2 order by c) union (select t2.a from t2 order by c))q where t1.a=q.a; a a 1 1 @@ -1303,13 +1303,13 @@ a a 6 6 # UNION ALL and EXCEPT analyze select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 1 0.50 100.00 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 -3 UNION t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 -4 EXCEPT t3 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 -NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL 3.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.a 1 0.50 100.00 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 +3 UNION t2 NULL ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 +4 EXCEPT t3 NULL ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 +NULL UNIT RESULT <unit2,3,4> NULL ALL NULL NULL NULL NULL NULL 3.00 NULL NULL select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a; a a 3 3 diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result index b990db091c7..c7b12e2da8a 100644 --- a/mysql-test/main/derived_cond_pushdown.result +++ b/mysql-test/main/derived_cond_pushdown.result @@ -113,10 +113,10 @@ a b max_c avg_c a b c d 6 20 315 279.3333 8 64 248 107 6 20 315 279.3333 8 80 800 314 explain select * from v1,t2 where (v1.max_c>214) and (t2.a>v1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,t2 where (v1.max_c>214) and (t2.a>v1.a); EXPLAIN { @@ -196,10 +196,10 @@ explain select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 group by a,b having max_c < 707) v1, @@ -287,10 +287,10 @@ a b max_c avg_c a b c d 5 27 132 132.0000 3 12 231 190 explain select * from v1,t2 where ((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,t2 where ((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a)); EXPLAIN @@ -364,10 +364,10 @@ a b max_c avg_c a b c d explain select * from v1,t2 where ((v1.max_c>300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or ((v1.max_c<135) and (v1.max_c<t2.c) and (v1.a=t2.a)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,t2 where ((v1.max_c>300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or ((v1.max_c<135) and (v1.max_c<t2.c) and (v1.a=t2.a)); @@ -433,10 +433,10 @@ a b max_c avg_c a b c d 8 33 404 213.6667 8 64 248 107 8 33 404 213.6667 8 80 800 314 explain select * from v1,t2 where (v1.a>6) and (t2.b>v1.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,t2 where (v1.a>6) and (t2.b>v1.b); EXPLAIN { @@ -510,10 +510,10 @@ a b max_c avg_c a b c d 8 33 404 213.6667 3 12 231 190 8 33 404 213.6667 6 23 303 909 explain select * from v2,t2 where (v2.b>25) and (t2.a<v2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v2,t2 where (v2.b>25) and (t2.a<v2.a); EXPLAIN { @@ -607,10 +607,10 @@ a b max_c avg_c a b c d 8 33 404 213.6667 6 23 303 909 explain select * from v1,t2 where ((v1.a>7) and (t2.c<v1.max_c)) or ((v1.a<2) and (t2.b<v1.b)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,t2 where ((v1.a>7) and (t2.c<v1.max_c)) or ((v1.a<2) and (t2.b<v1.b)); EXPLAIN @@ -698,10 +698,10 @@ a b max_c avg_c a b c d 8 33 404 213.6667 6 23 303 909 explain select * from v2,t2 where ((v2.a>7) and (t2.c<v2.max_c)) or ((v2.a>5) and (t2.b<v2.b)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v2,t2 where ((v2.a>7) and (t2.c<v2.max_c)) or ((v2.a>5) and (t2.b<v2.b)); EXPLAIN @@ -774,10 +774,10 @@ a b max_c avg_c a b c d explain select * from v1,t2 where ((v1.a>4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or ((v1.a<2) and (v1.max_c<t2.c) and (v1.max_c=t2.d)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,t2 where ((v1.a>4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or ((v1.a<2) and (v1.max_c<t2.c) and (v1.max_c=t2.d)); @@ -846,10 +846,10 @@ a b max_c avg_c a b c d 1 21 500 234.6000 8 80 800 314 1 21 500 234.6000 6 23 303 909 explain select * from v1,t2 where (v1.a<2) and (v1.max_c>400) and (t2.b>v1.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,t2 where (v1.a<2) and (v1.max_c>400) and (t2.b>v1.b); EXPLAIN { @@ -926,10 +926,10 @@ a avg_a b c a b c 10 2.62500000 33.4 13.65 10 31.4 13.65 explain select * from v_double as v,t2_double as t where (v.a=t.a) and (v.avg_a>0.45) and (v.b>10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t.a 2 Using where -2 DERIVED t1_double ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t.a 2 Using where +2 DERIVED t1_double NULL ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort explain format=json select * from v_double as v,t2_double as t where (v.a=t.a) and (v.avg_a>0.45) and (v.b>10); EXPLAIN @@ -995,10 +995,10 @@ a b avg_c a b c 3.0 3.0 16.0000 3.0 3.0 16 explain select * from v_decimal as v,t2_decimal as t where (v.a=t.a) and (v.avg_c>15) and (v.b>1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 3 test.t.a 2 Using where -2 DERIVED t1_decimal ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 3 test.t.a 2 Using where +2 DERIVED t1_decimal NULL ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort explain format=json select * from v_decimal as v,t2_decimal as t where (v.a=t.a) and (v.avg_c>15) and (v.b>1); EXPLAIN @@ -1086,10 +1086,10 @@ a b max_c avg_c a b c d explain select * from v1,t2 where ((v1.a>7) and (v1.max_c>300) and (t2.c<v1.max_c)) or ((v1.a<4) and (v1.max_c<500) and (t2.b<v1.b)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,t2 where ((v1.a>7) and (v1.max_c>300) and (t2.c<v1.max_c)) or ((v1.a<4) and (v1.max_c<500) and (t2.b<v1.b)); @@ -1187,10 +1187,10 @@ a b max_c avg_c a b c d 8 33 404 213.6667 3 12 231 190 8 33 404 213.6667 6 23 303 909 explain select * from v1,t2 where ((v1.a<2) and (v1.max_c>120)) or (v1.a>7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,t2 where ((v1.a<2) and (v1.max_c>120)) or (v1.a>7); EXPLAIN { @@ -1274,10 +1274,10 @@ a b max_c avg_c a b c d 8 33 404 213.6667 6 23 303 909 explain select * from v1,t2 where ((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,t2 where ((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7); EXPLAIN @@ -1350,10 +1350,10 @@ a b max_c avg_c a b c d explain select * from v1,t2 where ((v1.a<2) and (v1.max_c<200) and (t2.c>v1.max_c) and (v1.max_c=t2.d)) or ((v1.a>4) and (v1.max_c<500) and (t2.b<v1.b) and (v1.max_c=t2.c)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,t2 where ((v1.a<2) and (v1.max_c<200) and (t2.c>v1.max_c) and (v1.max_c=t2.d)) or ((v1.a>4) and (v1.max_c<500) and (t2.b<v1.b) and (v1.max_c=t2.c)); @@ -1561,10 +1561,10 @@ a b max_c avg_c a b c d 1 21 500 234.6000 1 21 909 12 1 19 107 107.0000 1 19 203 107 explain select * from v1,t2 where (t2.a=v1.a) and (v1.b=t2.b) and (v1.a=1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.b 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.b 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,t2 where (t2.a=v1.a) and (v1.b=t2.b) and (v1.a=1); EXPLAIN { @@ -1626,10 +1626,10 @@ select * from v1,t2 where (v1.a=5) and (v1.max_c=t2.d); a b max_c avg_c a b c d 5 16 207 207.0000 2 3 207 207 explain select * from v1,t2 where (v1.a=5) and (v1.max_c=t2.d); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.d 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.d 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,t2 where (v1.a=5) and (v1.max_c=t2.d); EXPLAIN { @@ -1698,10 +1698,10 @@ a b max_c avg_c a b c d 1 21 500 234.6000 1 19 203 107 1 19 107 107.0000 1 19 203 107 explain select * from v1,t2 where (t2.a<5) and (v1.a=t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,t2 where (t2.a<5) and (v1.a=t2.a); EXPLAIN { @@ -1760,10 +1760,10 @@ a b max_c avg_c a b c d select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a); a b max_c avg_c a b c d explain select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 10 test.t2.a,test.t2.a 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 10 test.t2.a,test.t2.a 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a); EXPLAIN { @@ -1827,10 +1827,10 @@ a b max_c avg_c a b c d 5 16 207 207.0000 2 3 207 207 6 20 315 279.3333 6 20 315 279 explain select * from v1,t2 where (t2.c>150) and (v1.max_c=t2.c); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,t2 where (t2.c>150) and (v1.max_c=t2.c); EXPLAIN { @@ -1890,10 +1890,10 @@ a b max_c avg_c a b c d select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a) and (v1.a=3); a b max_c avg_c a b c d explain select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a) and (v1.a=3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where explain format=json select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a) and (v1.a=3); EXPLAIN { @@ -1950,10 +1950,10 @@ select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2); a b max_c avg_c a b c d 1 21 500 234.6000 2 3 207 207 explain select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where explain format=json select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2); EXPLAIN { @@ -2015,10 +2015,10 @@ c Harry 4 d Harry 1 c Harry 4 b Harry 4 explain select * from v_char as v,t2_char as t where (v.a='c') and (v.b<'Hermes') and ((v.b=t.b) or (v.max_c>20)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12 Using where -1 PRIMARY t ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1_char ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 12 Using where +1 PRIMARY t NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1_char NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort explain format=json select * from v_char as v,t2_char as t where (v.a='c') and (v.b<'Hermes') and ((v.b=t.b) or (v.max_c>20)); EXPLAIN @@ -2098,10 +2098,10 @@ a b avg_c a b c 3.0 3.0 16.0000 2.0 3.0 16 explain select * from v_decimal as v,t2_decimal as t where (v.a=v.b) and (v.b=t.b) and ((t.b>1) or (v.a=1)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 6 test.t.b,test.t.b 2 -2 DERIVED t1_decimal ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 6 test.t.b,test.t.b 2 +2 DERIVED t1_decimal NULL ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort explain format=json select * from v_decimal as v,t2_decimal as t where (v.a=v.b) and (v.b=t.b) and ((t.b>1) or (v.a=1)); EXPLAIN @@ -2177,10 +2177,10 @@ a b max_c avg_c a b c d 6 20 315 279.3333 6 20 315 279 explain select * from v1,t2 where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,t2 where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c)); EXPLAIN @@ -2246,10 +2246,10 @@ a b max_c avg_c a b c d 6 20 315 279.3333 6 20 315 279 explain select * from v1,t2 where ((t2.a>5) and (v1.a=t2.a)) and ((t2.c>250) and (v1.max_c=t2.c)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 10 test.t2.a,test.t2.c 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 10 test.t2.a,test.t2.c 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,t2 where ((t2.a>5) and (v1.a=t2.a)) and ((t2.c>250) and (v1.max_c=t2.c)); EXPLAIN @@ -2324,10 +2324,10 @@ explain select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 group by a,b having max_c < 707) v1, t2 where (v1.a=8) and (v1.a=t2.a) and (v1.max_c=404); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 group by a,b having max_c < 707) v1, @@ -2396,10 +2396,10 @@ a b max_c avg_c a b c d 5 16 207 207.0000 2 3 207 207 explain select * from v1,t2 where (v1.a>3) and (v1.max_c>200) and (t2.b<v1.b) and (t2.d=v1.max_c); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.d 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.d 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,t2 where (v1.a>3) and (v1.max_c>200) and (t2.b<v1.b) and (t2.d=v1.max_c); EXPLAIN @@ -2466,10 +2466,10 @@ select * from v_double as v,t2_double as t where a avg_a b c a b c explain select * from v_double as v,t2_double as t where (v.b=v.c) and (v.c=t.c) and ((t.c>10) or (v.a=1)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 18 test.t.c,test.t.c 2 Using where -2 DERIVED t1_double ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 18 test.t.c,test.t.c 2 Using where +2 DERIVED t1_double NULL ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort explain format=json select * from v_double as v,t2_double as t where (v.b=v.c) and (v.c=t.c) and ((t.c>10) or (v.a=1)); EXPLAIN @@ -2541,10 +2541,10 @@ a avg_a b c a b c 1 0.50000000 12.5 18.9 7 17.89 18.9 explain select * from v_double as v,t2_double as t where (((v.a>0.2) or (v.b<17)) or (t.c>17)) and (t.c=v.c) and (v.c>18); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 9 test.t.c 2 Using where -2 DERIVED t1_double ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 9 test.t.c 2 Using where +2 DERIVED t1_double NULL ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort explain format=json select * from v_double as v,t2_double as t where (((v.a>0.2) or (v.b<17)) or (t.c>17)) and (t.c=v.c) and (v.c>18); EXPLAIN @@ -2647,10 +2647,10 @@ a b avg_c a b c 2.0 3.0 13.0000 2.0 3.0 16 explain select * from v_decimal as v,t2_decimal as t where (((v.a>4) or (v.a=2)) or (v.b>3)) and (v.avg_c=13); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY t ALL NULL NULL NULL NULL 9 Using join buffer (flat, BNL join) -2 DERIVED t1_decimal ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY t NULL ALL NULL NULL NULL NULL 9 Using join buffer (flat, BNL join) +2 DERIVED t1_decimal NULL ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort explain format=json select * from v_decimal as v,t2_decimal as t where (((v.a>4) or (v.a=2)) or (v.b>3)) and (v.avg_c=13); EXPLAIN @@ -2719,10 +2719,10 @@ explain select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 where t1.a>5 group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.a=v1.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 10 test.t2.a,test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 10 test.t2.a,test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 where t1.a>5 group by a,b having max_c < 707) v1, @@ -2798,10 +2798,10 @@ a b max_c avg_c a b c d 6 20 315 279.3333 1 21 909 12 8 33 404 213.6667 1 21 909 12 explain select * from v1,t2 where (t2.a<2) and (t2.c>900); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,t2 where (t2.a<2) and (t2.c>900); EXPLAIN { @@ -2865,10 +2865,10 @@ a b max_c avg_c a b c d 6 20 315 279.3333 6 20 315 279 1 19 107 107.0000 1 19 203 107 explain select * from v1,t2 where (v1.a=t2.a) and (v1.b=t2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 10 test.t2.a,test.t2.b 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 10 test.t2.a,test.t2.b 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.b=t2.b); EXPLAIN { @@ -2945,10 +2945,10 @@ a b max_c avg_c a b c d 8 33 404 213.6667 8 80 800 314 explain select * from v1,t2 where (t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,t2 where (t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6)); EXPLAIN @@ -3051,10 +3051,10 @@ a b max_c avg_c a b c d 6 20 315 279.3333 2 3 207 207 8 33 404 213.6667 2 3 207 207 explain select * from v1,t2 where (v1.a=1) or (v1.b=21) or (t2.a=2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,t2 where (v1.a=1) or (v1.b=21) or (t2.a=2); EXPLAIN { @@ -3127,10 +3127,10 @@ a b max_c avg_c a b c d 8 33 404 213.6667 1 21 909 12 explain select * from v1,t2 where (t2.a<2) and (t2.c>900) and ((v1.a<t2.a) or (t2.a<11)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,t2 where (t2.a<2) and (t2.c>900) and ((v1.a<t2.a) or (t2.a<11)); EXPLAIN @@ -3202,12 +3202,12 @@ a b max_c avg_c a b max_c avg_c a b c d 6 20 315 279.3333 6 20 315 279.3333 6 23 303 909 explain select * from v1,v2,t2 where (v1.a=v2.a) and (v1.a=t2.a) and (v2.b<50); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key1 key1 5 test.t2.a 2 -1 PRIMARY <derived3> ref key0 key0 5 test.t2.a 2 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key1 key1 5 test.t2.a 2 +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t2.a 2 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,v2,t2 where (v1.a=v2.a) and (v1.a=t2.a) and (v2.b<50); EXPLAIN @@ -3333,12 +3333,12 @@ a b max_c avg_c a b max_c avg_c a b c d 8 33 404 213.6667 8 33 404 213.6667 6 23 303 909 explain select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <derived3> ref key0 key0 5 v1.b 2 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> NULL ref key0 key0 5 v1.b 2 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b); EXPLAIN @@ -3445,12 +3445,12 @@ a b max_c avg_c a b max_c avg_c a b c d 8 33 404 213.6667 8 33 404 213.6667 8 80 800 314 explain select * from v1,v2,t2 where ((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join) -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,v2,t2 where ((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115)); EXPLAIN @@ -3560,12 +3560,12 @@ a b max_c avg_c a b max_c avg_c a b c d 1 19 107 107.0000 8 33 404 213.6667 1 19 203 107 explain select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and ((v2.b<50) or (v2.b=19)) and (v1.max_c<300); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join) -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and ((v2.b<50) or (v2.b=19)) and (v1.max_c<300); EXPLAIN @@ -3667,12 +3667,12 @@ select * from v1,v2,t2 where a b max_c avg_c a b max_c avg_c a b c d explain select * from v1,v2,t2 where (v1.a=t2.a) and (v1.a=v1.b) and (v1.a=v2.a) and (v2.max_c<300); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key1 key1 10 test.t2.a,test.t2.a 2 -1 PRIMARY <derived3> ref key0 key0 5 test.t2.a 2 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key1 key1 10 test.t2.a,test.t2.a 2 +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t2.a 2 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,v2,t2 where (v1.a=t2.a) and (v1.a=v1.b) and (v1.a=v2.a) and (v2.max_c<300); EXPLAIN @@ -3772,12 +3772,12 @@ a b max_c avg_c a b max_c avg_c a b c d select * from v1,v2,t2 where (v1.a=1) and (v1.b>10) and (v1.b=v2.b); a b max_c avg_c a b max_c avg_c a b c d explain select * from v1,v2,t2 where (v1.a=1) and (v1.b>10) and (v1.b=v2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <derived3> ref key0 key0 5 v1.b 2 -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> NULL ref key0 key0 5 v1.b 2 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v1,v2,t2 where (v1.a=1) and (v1.b>10) and (v1.b=v2.b); EXPLAIN { @@ -3888,10 +3888,10 @@ b Vika 2 b Ivan 11 b Vika 2 b Harry 4 explain select * from v_char as v,t2_char as t where (v.a=t.a) and (t.a='b') and ((v.b='Vika') or (v.b='Ali')); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12 Using where -1 PRIMARY t ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1_char ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 12 Using where +1 PRIMARY t NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1_char NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort explain format=json select * from v_char as v,t2_char as t where (v.a=t.a) and (t.a='b') and ((v.b='Vika') or (v.b='Ali')); EXPLAIN @@ -3990,14 +3990,14 @@ a b max_c avg_c a b max_c avg_c a b min_c a b c d explain select * from v1,v2,v3,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) and (v1.max_c<500) and (v3.a=t2.a) and (v2.max_c>300); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived4> ref key0 key0 5 test.t2.a 2 Using where -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join) -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 test.t2.a 2 Using where +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,v2,v3,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) and (v1.max_c<500) and (v3.a=t2.a) and (v2.max_c>300); @@ -4148,12 +4148,12 @@ where t1.a>5 group by a,b having max_c < 707) v1, (select a, b, min(c) as min_c from t1 where t1.a>5 group by a,b having min_c < 707) v2, t2 where (v1.a=v2.a) and (v1.b=t2.b) and (v1.max_c>130) and (v2.min_c<130); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key1 key1 5 test.t2.b 2 Using where -1 PRIMARY <derived3> ref key0 key0 5 v1.a 2 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key1 key1 5 test.t2.b 2 Using where +1 PRIMARY <derived3> NULL ref key0 key0 5 v1.a 2 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 where t1.a>5 group by a,b having max_c < 707) v1, @@ -4299,14 +4299,14 @@ where t1.a>5 group by a,b having min_c < 707) v2, where t1.a<8 group by a,b) v3, t2 where (v1.a=v2.a) and (v1.b=v3.b) and ((v3.avg_c>170) or (v3.a<5)) and ((v1.avg_c<400) or (v1.a>1)) and (v2.min_c<200); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <derived3> ref key0 key0 5 v1.a 2 Using where -1 PRIMARY <derived4> ref key0 key0 5 v1.b 2 Using where -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> NULL ref key0 key0 5 v1.a 2 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 v1.b 2 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 where t1.a>5 group by a,b having max_c < 707) v1, @@ -4475,10 +4475,10 @@ explain select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 group by a,b having max_c < 707) v1, t2 where ((v1.a=1) or (v1.max_c<300)) and (v1.b>25); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 group by a,b having max_c < 707) v1, @@ -4556,10 +4556,10 @@ explain select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 where t1.a>5 group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.b<30); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 where t1.a>5 group by a,b having max_c < 707) v1, @@ -4635,14 +4635,14 @@ a b max_c avg_c a b c d explain select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (t2.c>800) union select * from v1,t2 where (v1.max_c>100) and (v1.a>7) and (t2.d>800); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived3> ref key0 key0 5 test.t2.b 2 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 UNION t2 ALL NULL NULL NULL NULL 9 Using where -2 UNION <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t2.b 2 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 UNION t2 NULL ALL NULL NULL NULL NULL 9 Using where +2 UNION <derived4> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (t2.c>800) union select * from v1,t2 where (v1.max_c>100) and (v1.a>7) and (t2.d>800); @@ -4799,14 +4799,14 @@ a b max_c avg_c a b c d explain select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (v1.b=19) union select * from v1,t2 where ((v1.max_c>400) or (v1.avg_c>270)) and (v1.a<t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 UNION t2 ALL NULL NULL NULL NULL 9 -2 UNION <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 UNION t2 NULL ALL NULL NULL NULL NULL 9 +2 UNION <derived4> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (v1.b=19) union select * from v1,t2 where ((v1.max_c>400) or (v1.avg_c>270)) and (v1.a<t2.a); @@ -4973,14 +4973,14 @@ explain select * from v1,t2 where ((t2.a=v1.a) or (v1.b=t2.b)) and ((v1.a=1) or (v1.a=6)) union select * from v1,t2 where ((v1.a>3) and (v1.b>27)) or (v1.max_c>550); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 UNION t2 ALL NULL NULL NULL NULL 9 -2 UNION <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 UNION t2 NULL ALL NULL NULL NULL NULL 9 +2 UNION <derived4> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where ((t2.a=v1.a) or (v1.b=t2.b)) and ((v1.a=1) or (v1.a=6)) union @@ -5142,17 +5142,17 @@ select * from v2,t2 where union select * from v2,t2 where (v2.max_c=t2.c) and (v2.b<10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 UNION t2 ALL NULL NULL NULL NULL 9 Using where -2 UNION <derived5> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -5 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 UNION t2 ALL NULL NULL NULL NULL 9 Using where -3 UNION <derived6> ref key0 key0 5 test.t2.c 2 Using where -6 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -NULL UNION RESULT <union1,2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 UNION t2 NULL ALL NULL NULL NULL NULL 9 Using where +2 UNION <derived5> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +5 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t2 NULL ALL NULL NULL NULL NULL 9 Using where +3 UNION <derived6> NULL ref key0 key0 5 test.t2.c 2 Using where +6 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union1,2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where ((v1.a=1) and (v1.a=t2.a)) and ((v1.max_c<500) or (v1.avg_c>500)) union @@ -5357,12 +5357,12 @@ a b c a b c d 1 19 107 3 12 231 190 1 19 107 6 23 303 909 explain select * from v_union,t2 where (v_union.a<3) and (v_union.c>100); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 40 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 40 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v_union,t2 where (v_union.a<3) and (v_union.c>100); EXPLAIN { @@ -5478,12 +5478,12 @@ a b c a b c d 1 19 107 6 23 303 909 explain select * from v_union,t2 where ((v_union.a<2) or (v_union.c>800)) and (v_union.b>12); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 40 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 40 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v_union,t2 where ((v_union.a<2) or (v_union.c>800)) and (v_union.b>12); EXPLAIN @@ -5588,12 +5588,12 @@ a b c a b c d 1 19 107 1 19 203 107 explain select * from v_union,t2 where (v_union.a=1) and (v_union.a=t2.a) and (v_union.c<200); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 40 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 40 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v_union,t2 where (v_union.a=1) and (v_union.a=t2.a) and (v_union.c<200); EXPLAIN @@ -5698,10 +5698,10 @@ c Vika 7 c Ivan 2 c Vika 7 c Inga 2 explain select * from v_char as v,t2_char as t where (v.a=t.a) and (v.b='Vika') and (v.max_c>2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t ALL NULL NULL NULL NULL 12 Using where -1 PRIMARY <derived2> ref key0 key0 2 test.t.a 2 Using where -2 DERIVED t1_char ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 12 Using where +1 PRIMARY <derived2> NULL ref key0 key0 2 test.t.a 2 Using where +2 DERIVED t1_char NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort explain format=json select * from v_char as v,t2_char as t where (v.a=t.a) and (v.b='Vika') and (v.max_c>2); EXPLAIN @@ -5776,14 +5776,14 @@ a b c a b max_c avg_c a b c d explain select * from v_union,v1,t2 where (v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) and ((v_union.c>800) or (v1.max_c>200)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 40 Using where; Using join buffer (incremental, BNL join) -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 40 Using where; Using join buffer (incremental, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v_union,v1,t2 where (v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) and ((v_union.c>800) or (v1.max_c>200)); @@ -5934,13 +5934,13 @@ a b c a b c d 6 20 214.0000 6 23 303 909 explain select * from v2_union as v,t2 where ((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 6 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -4 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -NULL UNION RESULT <union2,3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 6 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +4 UNION t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3,4> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v2_union as v,t2 where ((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a); EXPLAIN @@ -6123,12 +6123,12 @@ a b c a b c d 6 20 309 6 23 303 909 6 20 7 6 23 303 909 explain select * from v3_union as v,t2 where (v.a=t2.a) and (v.c>6); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where -3 UNION t1 ALL NULL NULL NULL NULL 20 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 4 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v3_union as v,t2 where (v.a=t2.a) and (v.c>6); EXPLAIN { @@ -6255,12 +6255,12 @@ a b c a b c d 6 20 309 6 23 303 909 6 20 7 6 23 303 909 explain select * from v3_union as v,t2 where (v.a=t2.a) and ((t2.a>1) or (v.b<20)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where -3 UNION t1 ALL NULL NULL NULL NULL 20 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 4 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v3_union as v,t2 where (v.a=t2.a) and ((t2.a>1) or (v.b<20)); EXPLAIN { @@ -6354,12 +6354,12 @@ a b c a b c d 1 21 2 1 19 203 107 explain select * from v3_union as v,t2 where (v.a=t2.a) and ((v.b=19) or (v.b=21)) and ((v.c<3) or (v.c>600)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where -3 UNION t1 ALL NULL NULL NULL NULL 20 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 4 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v3_union as v,t2 where (v.a=t2.a) and ((v.b=19) or (v.b=21)) and ((v.c<3) or (v.c>600)); EXPLAIN @@ -6452,12 +6452,12 @@ a b c a b c d 7 11 608 7 13 312 406 1 19 207 1 19 203 107 explain select * from v4_union as v,t2 where (v.a=t2.a) and (v.b<20); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 UNION t1 ALL NULL NULL NULL NULL 20 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 4 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v4_union as v,t2 where (v.a=t2.a) and (v.b<20); EXPLAIN { @@ -6573,12 +6573,12 @@ a b c a b c d 8 33 504 8 80 800 314 explain select * from v4_union as v,t2 where (v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 UNION t1 ALL NULL NULL NULL NULL 20 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 4 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v4_union as v,t2 where (v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500); EXPLAIN @@ -6697,12 +6697,12 @@ a b min_c a b max_c avg_c 8 33 404 8 33 404 213.6667 explain select * from v4,v1 where (v4.a<13) and (v1.a>5) and (v1.b>12); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where -1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v4,v1 where (v4.a<13) and (v1.a>5) and (v1.b>12); EXPLAIN @@ -6816,13 +6816,13 @@ a b min_c a b max_c avg_c a b c d 8 33 404 8 33 404 213.6667 8 80 800 314 explain select * from v4,v1,t2 where (v4.a=t2.a) and (v4.a=v1.a) and (v1.b>30); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key1 key1 5 test.t2.a 2 -1 PRIMARY <derived4> ref key0 key0 5 test.t2.a 2 Using where -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key1 key1 5 test.t2.a 2 +1 PRIMARY <derived4> NULL ref key0 key0 5 test.t2.a 2 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v4,v1,t2 where (v4.a=t2.a) and (v4.a=v1.a) and (v1.b>30); EXPLAIN @@ -6951,13 +6951,13 @@ a b min_c a b max_c avg_c a b c d 6 20 315 6 20 315 279.3333 6 23 303 909 explain select * from v4,v1,t2 where (v4.a=t2.a) and (v4.a>1) and (v4.a=v1.a) and (v4.min_c>100) and (v1.b<30); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key1 key1 5 test.t2.a 2 Using where -1 PRIMARY <derived4> ref key0 key0 5 test.t2.a 2 Using where -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key1 key1 5 test.t2.a 2 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 test.t2.a 2 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v4,v1,t2 where (v4.a=t2.a) and (v4.a>1) and (v4.a=v1.a) and (v4.min_c>100) and (v1.b<30); EXPLAIN @@ -7173,13 +7173,13 @@ a b min_c a b max_c avg_c a b c d 8 33 404 8 33 404 213.6667 6 23 303 909 explain select * from v4,v1,t2 where (((v4.b>10) and (v4.a>1)) or (v4.b<20)) and (v1.max_c>200) and (v1.a=v4.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <derived4> ref key0 key0 5 v4.a 2 Using where -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort -2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived4> NULL ref key0 key0 5 v4.a 2 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v4,v1,t2 where (((v4.b>10) and (v4.a>1)) or (v4.b<20)) and (v1.max_c>200) and (v1.a=v4.a); EXPLAIN @@ -7303,12 +7303,12 @@ select * from v4,v2 where a b min_c a b max_c avg_c explain select * from v4,v2 where ((v4.a>12) and (v4.min_c<300) and (v4.b>13)) or (v4.a<1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where -1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v4,v2 where ((v4.a>12) and (v4.min_c<300) and (v4.b>13)) or (v4.a<1); EXPLAIN @@ -7420,12 +7420,12 @@ select * from v4,v2 where a b min_c a b max_c avg_c explain select * from v4,v2 where (v4.a=v2.b) and (v4.a=v4.b) and (v4.min_c<100); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where -1 PRIMARY <derived4> ref key0 key0 5 v4.a 2 -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 v4.a 2 +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v4,v2 where (v4.a=v2.b) and (v4.a=v4.b) and (v4.min_c<100); EXPLAIN @@ -7537,12 +7537,12 @@ select * from v4,v2 where a b min_c a b max_c avg_c explain select * from v4,v2 where (v4.a=v2.b) and (v4.a=v4.b) and (v2.b<30); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where -1 PRIMARY <derived4> ref key0 key0 5 v4.a 2 -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 v4.a 2 +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v4,v2 where (v4.a=v2.b) and (v4.a=v4.b) and (v2.b<30); EXPLAIN @@ -7653,12 +7653,12 @@ select * from v4,v2 where a b min_c a b max_c avg_c explain select * from v4,v2 where (v4.a=v2.b) and (v4.a=v4.b) and ((v2.b<30) or (v4.a>2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where -1 PRIMARY <derived4> ref key0 key0 5 v4.a 2 -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 v4.a 2 +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v4,v2 where (v4.a=v2.b) and (v4.a=v4.b) and ((v2.b<30) or (v4.a>2)); EXPLAIN @@ -7776,12 +7776,12 @@ a b min_c a b max_c avg_c explain select * from v4,v2 where (((v4.a<12) and (v4.b>13)) or (v4.a>10)) and (v4.min_c=v2.max_c) and (v4.min_c>100); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where -1 PRIMARY <derived4> ref key0 key0 5 v4.min_c 2 -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 v4.min_c 2 +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v4,v2 where (((v4.a<12) and (v4.b>13)) or (v4.a>10)) and (v4.min_c=v2.max_c) and (v4.min_c>100); @@ -7899,13 +7899,13 @@ a b min_c a b max_c avg_c a b c d explain select * from v4,v2,t2 where (((v4.a<12) and (t2.b>13)) or (v4.a>10)) and (v4.min_c=t2.c) and (t2.c>100); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2 Using where -1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) -4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c 2 Using where +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from v4,v2,t2 where (((v4.a<12) and (t2.b>13)) or (v4.a>10)) and (v4.min_c=t2.c) and (t2.c>100); @@ -8033,9 +8033,9 @@ EXPLAIN EXTENDED SELECT * FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 WHERE f = 8; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 100.00 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 /* select#1 */ select `sq1`.`f` AS `f` from (/* select#3 */ select min(`test`.`t1`.`i`) AS `f` from `test`.`t1` having `f` = 8) `sq1` where `sq1`.`f` = 8 SELECT * @@ -8243,11 +8243,11 @@ SELECT b FROM v2 WHERE b < a OR b IN ( SELECT d FROM v4 WHERE s > a ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) -3 DEPENDENT SUBQUERY <derived5> index_subquery key0 key0 5 func 2 Using where -5 DERIVED t4 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) +3 DEPENDENT SUBQUERY <derived5> NULL index_subquery key0 key0 5 func 2 Using where +5 DERIVED t4 NULL ALL NULL NULL NULL NULL 5 Using temporary; Using filesort explain format=json SELECT * FROM t1 WHERE a IN ( SELECT b FROM v2 WHERE b < a OR b IN ( SELECT d FROM v4 WHERE s > a @@ -10232,10 +10232,10 @@ HAVING max_c > 37 ) AS v1 WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.a=t2.x) AND (v1.max_c>30); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 Using where EXPLAIN FORMAT=JSON SELECT * FROM t2, ( @@ -10317,10 +10317,10 @@ HAVING max_c > 37 ) AS v1 WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND (v1.a=t2.x) AND (v1.max_c>30); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 Using where EXPLAIN FORMAT=JSON SELECT * FROM t2, ( @@ -10431,10 +10431,10 @@ HAVING max_f>18 WHERE d_tab.e>1 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY <derived3> ref key0 key0 10 test.t1.a,test.t1.b 2 FirstMatch(t1) -3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY <derived3> NULL ref key0 key0 10 test.t1.a,test.t1.b 2 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.a,t1.b) IN ( @@ -10530,10 +10530,10 @@ HAVING max_f>18 WHERE d_tab.max_f<25 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY <derived3> ref key0 key0 10 test.t1.a,test.t1.b 2 FirstMatch(t1) -3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY <derived3> NULL ref key0 key0 10 test.t1.a,test.t1.b 2 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 5 Using temporary; Using filesort EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.a,t1.b) IN ( @@ -10627,11 +10627,11 @@ WHERE d_tab.e>1 GROUP BY d_tab.g ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 5 Using where; Using temporary -3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.a,t1.b) IN ( @@ -10743,11 +10743,11 @@ WHERE d_tab.max_f>20 GROUP BY d_tab.g ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 5 Using where; Using temporary -3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 5 Using temporary; Using filesort EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.a,t1.b) IN ( @@ -11738,11 +11738,11 @@ INSERT INTO t1 SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL; EXPLAIN INSERT INTO t1 SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 144 Using where -2 DERIVED <derived4> ALL NULL NULL NULL NULL 12 -2 DERIVED t1 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -4 DERIVED t1 ALL NULL NULL NULL NULL 12 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 144 Using where +2 DERIVED <derived4> NULL ALL NULL NULL NULL NULL 12 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 12 EXPLAIN FORMAT=JSON INSERT INTO t1 SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL; EXPLAIN @@ -12147,10 +12147,10 @@ x explain extended select * from (select min(a) as x from t1 union all select max(a) as y from t1) t where x>0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 100.00 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 -3 UNION t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 +3 UNION t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `t`.`x` AS `x` from (/* select#2 */ select min(`test`.`t1`.`a`) AS `x` from `test`.`t1` having `x` > 0 union all /* select#3 */ select max(`test`.`t1`.`a`) AS `x` from `test`.`t1` having `x` > 0) `t` where `t`.`x` > 0 prepare stmt from "select * @@ -12190,9 +12190,9 @@ a f g 1 1 1 3 3 3 explain extended select * from (select * from v1) as dt where a=f and a=g; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 7 100.00 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 7 100.00 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `v1`.`a` AS `a`,`v1`.`f` AS `f`,`v1`.`g` AS `g` from `test`.`v1` where `v1`.`a` = `v1`.`f` and `v1`.`a` = `v1`.`g` create view v2 as select a, min(1) as f, min(1) as g from t1 group by a; @@ -12205,9 +12205,9 @@ select * from (select * from v2) as dt where a=f and a=g; a f g 1 1 1 explain extended select * from (select * from v2) as dt where a=f and a=g; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 7 100.00 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 7 100.00 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `v2`.`a` AS `a`,`v2`.`f` AS `f`,`v2`.`g` AS `g` from `test`.`v2` where `v2`.`a` = `v2`.`f` and `v2`.`a` = `v2`.`g` drop view v1,v2; @@ -12244,10 +12244,10 @@ select col2, col1 from v1 union all select col2, col1 from v2; explain select * from v3 where col1=123; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where -2 DERIVED t1 ref a a 5 const 1 -3 UNION t1 ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 Using where +2 DERIVED t1 NULL ref a a 5 const 1 +3 UNION t1 NULL ref a a 5 const 1 # This must use ref accesses for reading table t1, not full scans: explain format=json select * from v3 where col1=123 and col2=321; @@ -12480,12 +12480,12 @@ a b c a b c 1 21 101 1 19 132 1 19 117 1 19 132 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a<5); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a<5); EXPLAIN { @@ -12582,12 +12582,12 @@ select * from v1,t2 where (v1.a=t2.a) and (v1.a=8); a b c a b c 8 33 114 8 33 117 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a=8); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a=8); EXPLAIN { @@ -12684,12 +12684,12 @@ select * from v1,t2 where (v1.a=t2.a) and (t2.a=8); a b c a b c 8 33 114 8 33 117 explain select * from v1,t2 where (v1.a=t2.a) and (t2.a=8); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (t2.a=8); EXPLAIN { @@ -12788,12 +12788,12 @@ a b c a b c 5 16 207 5 14 312 5 16 207 5 33 207 explain select * from v1,t2 where (v1.a=t2.a) and (v1.c>200); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.c>200); EXPLAIN { @@ -12893,12 +12893,12 @@ a b c a b c 1 19 117 1 16 909 1 19 117 1 19 132 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>110); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>110); EXPLAIN { @@ -12999,12 +12999,12 @@ a b c a b c 5 16 207 5 33 207 8 33 114 8 33 117 explain select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19)); EXPLAIN { @@ -13110,12 +13110,12 @@ a b c a b c 1 21 101 1 19 132 explain select * from v1,t2 where (v1.a=t2.a) and ((v1.c>200) or (v1.c<105)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and ((v1.c>200) or (v1.c<105)); EXPLAIN @@ -13243,12 +13243,12 @@ a b c a b c explain select * from v1,t2 where ((v1.a>3) and (t2.c>110) and (v1.c=t2.c)) or ((v1.a=1) and (v1.c<110)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where ((v1.a>3) and (t2.c>110) and (v1.c=t2.c)) or ((v1.a=1) and (v1.c<110)); @@ -13398,12 +13398,12 @@ where (d1.b=t2.b) and (((t2.b>13) and (t2.c=909)) or ((d1.a<4) and (d1.c<200))); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.b 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.b 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from t2, (select a, b, min(c) as c from t1 @@ -13523,12 +13523,12 @@ a b c a b c 1 33 988 1 19 132 1 21 500 1 19 132 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a<5); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a<5); EXPLAIN { @@ -13627,12 +13627,12 @@ a b c a b c 6 20 315 6 20 211 6 20 315 6 23 303 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a=6); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a=6); EXPLAIN { @@ -13731,12 +13731,12 @@ a b c a b c 6 20 315 6 20 211 6 20 315 6 23 303 explain select * from v1,t2 where (v1.a=t2.a) and (t2.a=6); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (t2.a=6); EXPLAIN { @@ -13839,12 +13839,12 @@ a b c a b c 5 14 787 5 33 207 1 33 988 1 19 132 explain select * from v1,t2 where (v1.a=t2.a) and (v1.c>500); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.c>500); EXPLAIN { @@ -13944,12 +13944,12 @@ a b c a b c 1 33 988 1 16 909 1 33 988 1 19 132 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>500); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>500); EXPLAIN { @@ -14052,12 +14052,12 @@ a b c a b c 5 14 787 5 33 207 1 33 988 1 19 132 explain select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19)); EXPLAIN { @@ -14163,12 +14163,12 @@ a b c a b c 6 20 315 6 23 303 explain select * from v1,t2 where (v1.a=t2.a) and ((v1.c<400) or (v1.c>800)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and ((v1.c<400) or (v1.c>800)); EXPLAIN @@ -14293,12 +14293,12 @@ explain select * from v1,t2 where (v1.c=t2.c) and ((v1.a>1) and (t2.c<500)) or ((v1.a=1) and (v1.c>500)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.c=t2.c) and ((v1.a>1) and (t2.c<500)) or @@ -14445,12 +14445,12 @@ where (d1.b=t2.b) and (((t2.b>13) and (t2.c=988)) or ((d1.a>4) and (d1.c>500))); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.b 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.b 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from t2, (select a, b, max(c) as c from t1 @@ -14569,15 +14569,15 @@ a b c a b c 6 20 309 6 20 211 6 20 309 6 23 303 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 3 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 UNION <derived4> ALL NULL NULL NULL NULL 18 Using where -4 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -5 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL INTERSECT RESULT <intersect4,5> ALL NULL NULL NULL NULL NULL -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 3 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 UNION <derived4> NULL ALL NULL NULL NULL NULL 18 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +5 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect4,5> NULL ALL NULL NULL NULL NULL NULL +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200); EXPLAIN { @@ -14737,13 +14737,13 @@ a b c a b c 5 27 132 5 33 207 8 33 123 8 33 117 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 3 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -4 UNION t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 3 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +4 UNION t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200); EXPLAIN { @@ -14875,13 +14875,13 @@ a b c a b c 6 20 309 6 20 211 6 20 309 6 23 303 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 3 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 UNION t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -4 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 3 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +4 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200); EXPLAIN { @@ -15015,13 +15015,13 @@ a b c a b c 5 27 132 5 33 207 8 33 123 8 33 117 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 3 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -4 UNION t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 3 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +4 UNION t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200); EXPLAIN { @@ -15153,13 +15153,13 @@ a b c a b c 5 27 132 5 14 312 5 27 132 5 33 207 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<150); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -4 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +4 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<150); EXPLAIN { @@ -15289,15 +15289,15 @@ select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); a b c a b c 8 33 123 8 33 117 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 EXCEPT <derived4> ALL NULL NULL NULL NULL 18 Using where -4 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -5 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL INTERSECT RESULT <intersect4,5> ALL NULL NULL NULL NULL NULL -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT <derived4> NULL ALL NULL NULL NULL NULL 18 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +5 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect4,5> NULL ALL NULL NULL NULL NULL NULL +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); EXPLAIN { @@ -15456,16 +15456,16 @@ select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); a b c a b c 8 33 123 8 33 117 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 3 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 EXCEPT <derived4> ALL NULL NULL NULL NULL 18 Using where -4 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -5 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL INTERSECT RESULT <intersect4,5> ALL NULL NULL NULL NULL NULL -6 UNION t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL UNIT RESULT <unit2,3,6> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 3 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT <derived4> NULL ALL NULL NULL NULL NULL 18 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +5 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect4,5> NULL ALL NULL NULL NULL NULL NULL +6 UNION t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,6> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); EXPLAIN { @@ -15647,13 +15647,13 @@ a b c a b c 5 27 132 5 14 312 5 27 132 5 33 207 explain select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED <derived3> ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -4 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL INTERSECT RESULT <intersect3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +4 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect3,4> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150); EXPLAIN { @@ -15785,13 +15785,13 @@ a b c a b c 5 27 132 5 14 312 5 27 132 5 33 207 explain select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED <derived3> ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -4 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL EXCEPT RESULT <except3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +4 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except3,4> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150); EXPLAIN { @@ -15920,12 +15920,12 @@ a b c a b c 6 20 315 6 20 211 6 20 315 6 23 303 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.b>12) and (v1.c<450); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.b>12) and (v1.c<450); EXPLAIN { @@ -16032,12 +16032,12 @@ a b c a b c 1 21 988 1 16 909 1 21 988 1 19 132 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a<2) and (v1.b<30) and (v1.c>450); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a<2) and (v1.b<30) and (v1.c>450); EXPLAIN { @@ -16146,12 +16146,12 @@ a b c a b c 1 21 988 1 16 909 1 21 988 1 19 132 explain select * from v1,t2 where (v1.a=t2.a) and ((v1.a<2) or (v1.a<5)) and (v1.c>450); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and ((v1.a<2) or (v1.a<5)) and (v1.c>450); EXPLAIN { @@ -16261,13 +16261,13 @@ a b c a b c 5 14 787 5 14 312 5 14 787 5 33 207 explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>1) and (v1.b > 12) and (v1.c>400); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 3 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -4 UNION t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort -NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 3 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +4 UNION t1 NULL ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>1) and (v1.b > 12) and (v1.c>400); EXPLAIN { @@ -16408,10 +16408,10 @@ a b max_c a b c 3 21 500 3 21 231 1 21 345 3 21 231 explain select * from v1,t2 where (v1.b=t2.b) and (v1.a<5); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.b 2 Using where -2 DERIVED t3 range i1 i1 5 NULL 5 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.b 2 Using where +2 DERIVED t3 NULL range i1 i1 5 NULL 5 Using index condition explain format=json select * from v1,t2 where (v1.b=t2.b) and (v1.a<5); EXPLAIN { @@ -16485,12 +16485,12 @@ a b c a b c 2 33 7 8 33 117 3 21 500 3 21 231 explain select * from v1,t2 where (v1.b=t2.b) and (v1.a<4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where; Using join buffer (flat, BNL join) -2 DERIVED t3 range i1 i1 5 NULL 2 Using index condition -3 UNION t3 range i1 i1 5 NULL 1 Using index condition -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where; Using join buffer (flat, BNL join) +2 DERIVED t3 NULL range i1 i1 5 NULL 2 Using index condition +3 UNION t3 NULL range i1 i1 5 NULL 1 Using index condition +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.b=t2.b) and (v1.a<4); EXPLAIN { @@ -16595,12 +16595,12 @@ a b c a b c 1 19 107 1 19 132 2 33 7 8 33 117 explain select * from v1,t2 where (v1.b=t2.b) and (v1.a<3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.b 2 Using where -2 DERIVED t3 range i1 i1 5 NULL 1 Using index condition -3 UNION t3 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.b 2 Using where +2 DERIVED t3 NULL range i1 i1 5 NULL 1 Using index condition +3 UNION t3 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.b=t2.b) and (v1.a<3); EXPLAIN { @@ -16730,9 +16730,9 @@ a c sum(b) over (partition by a,c) 7 cc 28 explain select * from (select a, c, sum(b) over (partition by a,c) from t2) as t where t.a > 2 and t.c in ('aa','bb','cc'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 16 Using where -2 DERIVED t2 ALL idx NULL NULL NULL 20 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 16 Using where +2 DERIVED t2 NULL ALL idx NULL NULL NULL 20 Using where; Using temporary explain format=json select * from (select a, c, sum(b) over (partition by a,c) from t2) as t where t.a > 2 and t.c in ('aa','bb','cc'); EXPLAIN @@ -16839,10 +16839,10 @@ union all select 2 as n, a, c, sum(b) over (partition by a) as s from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 32 Using where -2 DERIVED t2 ALL idx NULL NULL NULL 20 Using where; Using temporary -3 UNION t2 ALL idx NULL NULL NULL 20 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 32 Using where +2 DERIVED t2 NULL ALL idx NULL NULL NULL 20 Using where; Using temporary +3 UNION t2 NULL ALL idx NULL NULL NULL 20 Using where; Using temporary explain format=json select * from ( select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 @@ -16953,10 +16953,10 @@ a c s a c explain select * from (select a, c, sum(b) over (partition by a,c) as s from t2) as t, t1 where t1.a=t.a and t1.c=t.c and t1.c in ('aa','bb','cc'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where -1 PRIMARY <derived2> ref key0 key0 24 test.t1.a,test.t1.c 2 -2 DERIVED t2 ALL NULL NULL NULL NULL 20 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where +1 PRIMARY <derived2> NULL ref key0 key0 24 test.t1.a,test.t1.c 2 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary explain format=json select * from (select a, c, sum(b) over (partition by a,c) as s from t2) as t, t1 where t1.a=t.a and t1.c=t.c and t1.c in ('aa','bb','cc'); @@ -17086,11 +17086,11 @@ union all select 3 as n, a, c, sum(b) as s from t2 group by a ) as t where t.a > 2 and t.c in ('aa','bb','cc'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 48 Using where -2 DERIVED t2 ALL idx NULL NULL NULL 20 Using where; Using temporary -3 UNION t2 ALL idx NULL NULL NULL 20 Using where; Using temporary -4 UNION t2 ALL idx NULL NULL NULL 20 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 48 Using where +2 DERIVED t2 NULL ALL idx NULL NULL NULL 20 Using where; Using temporary +3 UNION t2 NULL ALL idx NULL NULL NULL 20 Using where; Using temporary +4 UNION t2 NULL ALL idx NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from ( select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 @@ -17243,9 +17243,9 @@ sum(b) over (partition by a,c) as sum_b, avg(b) over (partition by a,c) as avg_b from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 16 Using where -2 DERIVED t2 ALL idx NULL NULL NULL 20 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 16 Using where +2 DERIVED t2 NULL ALL idx NULL NULL NULL 20 Using where; Using temporary explain format=json select * from (select a, c, sum(b) over (partition by a,c) as sum_b, avg(b) over (partition by a,c) as avg_b @@ -17331,9 +17331,9 @@ sum(b) over (partition by a,c) as sum_b, avg(b) over (partition by a) as avg_b from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 16 Using where -2 DERIVED t2 ALL idx NULL NULL NULL 20 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 16 Using where +2 DERIVED t2 NULL ALL idx NULL NULL NULL 20 Using where; Using temporary explain format=json select * from (select a, c, sum(b) over (partition by a,c) as sum_b, avg(b) over (partition by a) as avg_b @@ -17419,9 +17419,9 @@ sum(b) over (partition by a,c) as sum_b, avg(b) over (partition by c) as avg_b from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where -2 DERIVED t2 ALL NULL NULL NULL NULL 20 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 20 Using where; Using temporary explain format=json select * from (select a, c, sum(b) over (partition by a,c) as sum_b, avg(b) over (partition by c) as avg_b @@ -17531,10 +17531,10 @@ from t1 join (select a, sum(t2.b) as s, min(t2.c) as m from t2 group by t2.a) t on t1.a=t.a where t1.b < 3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 range idx_b idx_b 5 NULL 4 100.00 Using index condition; Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 2 100.00 -2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range idx_b idx_b 5 NULL 4 100.00 Using index condition; Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.a 2 100.00 +2 LATERAL DERIVED t2 NULL ref idx_a idx_a 5 test.t1.a 1 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`s` AS `s`,`t`.`m` AS `m` from `test`.`t1` join (/* select#2 */ select `test`.`t2`.`a` AS `a`,sum(`test`.`t2`.`b`) AS `s`,min(`test`.`t2`.`c`) AS `m` from `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` group by `test`.`t2`.`a`) `t` where `t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` < 3 explain format=json select t1.a,t.s,t.m @@ -17652,10 +17652,10 @@ from t1 join (select a, sum(t2.b) as s, min(t2.b) as m from t2 group by t2.a) t on t1.a=t.a where t1.b <= 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL idx_b NULL NULL NULL 12 83.33 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 2 100.00 -2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL idx_b NULL NULL NULL 12 83.33 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.a 2 100.00 +2 LATERAL DERIVED t2 NULL ref idx_a idx_a 5 test.t1.a 1 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`s` AS `s`,`t`.`m` AS `m` from `test`.`t1` join (/* select#2 */ select `test`.`t2`.`a` AS `a`,sum(`test`.`t2`.`b`) AS `s`,min(`test`.`t2`.`b`) AS `m` from `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` group by `test`.`t2`.`a`) `t` where `t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` <= 5 explain format=json select t1.a,t.s,t.m @@ -17767,10 +17767,10 @@ explain extended select t1.a,t.max,t.min from t1 left join (select a, max(t2.b) max, min(t2.b) min from t2 group by t2.a) t on t1.a=t.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 -1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 9 100.00 Using where -2 DERIVED t2 ALL idx_a NULL NULL NULL 90 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 12 100.00 +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.a 9 100.00 Using where +2 DERIVED t2 NULL ALL idx_a NULL NULL NULL 90 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t1` left join (/* select#2 */ select `test`.`t2`.`a` AS `a`,max(`test`.`t2`.`b`) AS `max`,min(`test`.`t2`.`b`) AS `min` from `test`.`t2` group by `test`.`t2`.`a`) `t` on(`t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) where 1 explain format=json select t1.a,t.max,t.min @@ -17868,10 +17868,10 @@ from t3 join (select a, c, max(b) max, min(b) min from t4 group by a,c) t on t3.a=t.a and t3.c=t.c where t3.b > 15; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 range idx_b idx_b 5 NULL 2 100.00 Using index condition; Using where -1 PRIMARY <derived2> ref key0 key0 133 test.t3.a,test.t3.c 2 100.00 -2 LATERAL DERIVED t4 ref idx idx 133 test.t3.a,test.t3.c 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL range idx_b idx_b 5 NULL 2 100.00 Using index condition; Using where +1 PRIMARY <derived2> NULL ref key0 key0 133 test.t3.a,test.t3.c 2 100.00 +2 LATERAL DERIVED t4 NULL ref idx idx 133 test.t3.a,test.t3.c 1 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t3` join (/* select#2 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` where `test`.`t4`.`a` = `test`.`t3`.`a` and `test`.`t4`.`c` = `test`.`t3`.`c` group by `test`.`t4`.`a`,`test`.`t4`.`c`) `t` where `t`.`a` = `test`.`t3`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t3`.`b` > 15 explain format=json select t3.a,t3.c,t.max,t.min @@ -17957,10 +17957,10 @@ from t3 join (select a, c, max(b) max, min(b) min from t4 group by a,c) t on t3.a=t.a and t3.c=t.c where t3.b <= 15; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL idx_b NULL NULL NULL 12 83.33 Using where -1 PRIMARY <derived2> ref key0 key0 133 test.t3.a,test.t3.c 4 100.00 -2 DERIVED t4 ALL idx NULL NULL NULL 40 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL idx_b NULL NULL NULL 12 83.33 Using where +1 PRIMARY <derived2> NULL ref key0 key0 133 test.t3.a,test.t3.c 4 100.00 +2 DERIVED t4 NULL ALL idx NULL NULL NULL 40 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t3` join (/* select#2 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` group by `test`.`t4`.`a`,`test`.`t4`.`c`) `t` where `t`.`a` = `test`.`t3`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t3`.`b` <= 15 explain format=json select t3.a,t3.c,t.max,t.min @@ -18041,10 +18041,10 @@ from t3 join (select a, c, max(b) max, min(b) min from t4 group by c,a) t on t3.a=t.a and t3.c=t.c where t3.b > 15; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 range idx_b idx_b 5 NULL 2 100.00 Using index condition; Using where -1 PRIMARY <derived2> ref key0 key0 133 test.t3.a,test.t3.c 2 100.00 -2 LATERAL DERIVED t4 ref idx idx 133 test.t3.a,test.t3.c 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL range idx_b idx_b 5 NULL 2 100.00 Using index condition; Using where +1 PRIMARY <derived2> NULL ref key0 key0 133 test.t3.a,test.t3.c 2 100.00 +2 LATERAL DERIVED t4 NULL ref idx idx 133 test.t3.a,test.t3.c 1 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t3` join (/* select#2 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` where `test`.`t4`.`a` = `test`.`t3`.`a` and `test`.`t4`.`c` = `test`.`t3`.`c` group by `test`.`t4`.`c`,`test`.`t4`.`a`) `t` where `t`.`a` = `test`.`t3`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t3`.`b` > 15 explain format=json select t3.a,t3.c,t.max,t.min @@ -18130,10 +18130,10 @@ from t3 join (select a, c, max(b) max, min(b) min from t4 group by c,a) t on t3.a=t.a and t3.c=t.c where t3.b <= 15; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL idx_b NULL NULL NULL 12 83.33 Using where -1 PRIMARY <derived2> ref key0 key0 133 test.t3.a,test.t3.c 4 100.00 -2 DERIVED t4 ALL idx NULL NULL NULL 40 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL idx_b NULL NULL NULL 12 83.33 Using where +1 PRIMARY <derived2> NULL ref key0 key0 133 test.t3.a,test.t3.c 4 100.00 +2 DERIVED t4 NULL ALL idx NULL NULL NULL 40 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t3` join (/* select#2 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` group by `test`.`t4`.`c`,`test`.`t4`.`a`) `t` where `t`.`a` = `test`.`t3`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t3`.`b` <= 15 explain format=json select t3.a,t3.c,t.max,t.min @@ -18226,11 +18226,11 @@ a b c t_c max min explain extended select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 range idx idx 133 NULL 2 100.00 Using index condition; Using where -1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 2 100.00 -2 LATERAL DERIVED t4 ref idx_c idx_c 128 test.t3.c 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL range idx idx 133 NULL 2 100.00 Using index condition; Using where +1 PRIMARY t3 NULL ref idx_a idx_a 5 test.t2.a 1 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 128 test.t3.c 2 100.00 +2 LATERAL DERIVED t4 NULL ref idx_c idx_c 128 test.t3.c 2 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`t`.`c` AS `t_c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` where `test`.`t4`.`c` = `test`.`t3`.`c` group by `test`.`t4`.`c`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` between 80 and 85 and `test`.`t2`.`c` in ('y','z') explain format=json select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min @@ -18386,11 +18386,11 @@ a b c t_c max min explain extended select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t where t2.b < 40 and t2.a=t3.a and t3.c=t.c; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 90 60.00 Using where -1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 10 100.00 -2 DERIVED t4 ALL idx_c NULL NULL NULL 160 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 90 60.00 Using where +1 PRIMARY t3 NULL ref idx_a idx_a 5 test.t2.a 1 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 128 test.t3.c 10 100.00 +2 DERIVED t4 NULL ALL idx_c NULL NULL NULL 160 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`t`.`c` AS `t_c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` group by `test`.`t4`.`c`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` < 40 explain format=json select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min @@ -18498,11 +18498,11 @@ a b c a b c c b sum(b) over (partition by c) explain extended select * from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 range idx idx 133 NULL 2 100.00 Using index condition; Using where -1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 2 100.00 -2 LATERAL DERIVED t4 ref idx_c idx_c 128 test.t3.c 2 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL range idx idx 133 NULL 2 100.00 Using index condition; Using where +1 PRIMARY t3 NULL ref idx_a idx_a 5 test.t2.a 1 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 128 test.t3.c 2 100.00 +2 LATERAL DERIVED t4 NULL ref idx_c idx_c 128 test.t3.c 2 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`t`.`c` AS `c`,`t`.`b` AS `b`,`t`.`sum(b) over (partition by c)` AS `sum(b) over (partition by c)` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,`test`.`t4`.`b` AS `b`,sum(`test`.`t4`.`b`) over ( partition by `test`.`t4`.`c`) AS `sum(b) over (partition by c)` from `test`.`t4` where `test`.`t4`.`c` = `test`.`t3`.`c`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` between 80 and 85 and `test`.`t2`.`c` in ('y','z') explain format=json select * @@ -18909,11 +18909,11 @@ a b c a b c c b sum(b) over (partition by c) explain extended select * from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t where t2.b < 40 and t2.a=t3.a and t3.c=t.c; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 90 60.00 Using where -1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 10 100.00 -2 DERIVED t4 ALL idx_c NULL NULL NULL 160 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 90 60.00 Using where +1 PRIMARY t3 NULL ref idx_a idx_a 5 test.t2.a 1 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 128 test.t3.c 10 100.00 +2 DERIVED t4 NULL ALL idx_c NULL NULL NULL 160 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`t`.`c` AS `c`,`t`.`b` AS `b`,`t`.`sum(b) over (partition by c)` AS `sum(b) over (partition by c)` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,`test`.`t4`.`b` AS `b`,sum(`test`.`t4`.`b`) over ( partition by `test`.`t4`.`c`) AS `sum(b) over (partition by c)` from `test`.`t4`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` < 40 explain format=json select * @@ -19026,13 +19026,13 @@ SELECT * FROM t4 WHERE c IN ( SELECT c FROM v1 ) and a < 2; a c 1 foo explain extended SELECT * FROM t4 WHERE c IN ( SELECT c FROM v1 ) and a < 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t4 range a a 5 NULL 1 100.00 Using index condition; Using where -1 PRIMARY <derived3> ref key0 key0 128 test.t4.c 2 100.00 FirstMatch(t4) -3 LATERAL DERIVED t3 ref c c 128 test.t4.c 2 100.00 -3 LATERAL DERIVED <subquery4> eq_ref distinct_key distinct_key 4 func 1 100.00 -4 MATERIALIZED t1 ALL NULL NULL NULL NULL 3 100.00 -4 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t4 NULL range a a 5 NULL 1 100.00 Using index condition; Using where +1 PRIMARY <derived3> NULL ref key0 key0 128 test.t4.c 2 100.00 FirstMatch(t4) +3 LATERAL DERIVED t3 NULL ref c c 128 test.t4.c 2 100.00 +3 LATERAL DERIVED <subquery4> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +4 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 100.00 +4 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`c` AS `c` from `test`.`t4` semi join (`test`.`v1`) where `v1`.`c` = `test`.`t4`.`c` and `test`.`t4`.`a` < 2 explain format=json SELECT * FROM t4 WHERE c IN ( SELECT c FROM v1 ) and a < 2; @@ -19180,9 +19180,9 @@ SELECT * FROM cte; pk EXPLAIN EXTENDED WITH cte AS ( SELECT pk FROM t1 WHERE pk IS NULL GROUP BY pk ) SELECT * FROM cte; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 0 0.00 Const row not found -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 with cte as (/* select#2 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where 0 group by `test`.`t1`.`pk`)/* select#1 */ select NULL AS `pk` from `cte` DROP TABLE t1; @@ -19199,10 +19199,10 @@ pk1 f pk2 cnt 1 0 1 1 2 0 2 1 EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN v2 ON pk1 = pk2 WHERE f <> 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 2 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 4 test.t1.pk1 2 100.00 -2 LATERAL DERIVED t2 eq_ref PRIMARY PRIMARY 4 test.t1.pk1 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 2 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 4 test.t1.pk1 2 100.00 +2 LATERAL DERIVED t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.pk1 1 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`f` AS `f`,`v2`.`pk2` AS `pk2`,`v2`.`cnt` AS `cnt` from `test`.`t1` join `test`.`v2` where `v2`.`pk2` = `test`.`t1`.`pk1` and `test`.`t1`.`f` <> 5 EXPLAIN FORMAT=JSON SELECT * FROM t1 INNER JOIN v2 ON pk1 = pk2 WHERE f <> 5; @@ -19282,9 +19282,9 @@ SELECT * FROM v1 JOIN v2 ON v1.f = v2.f; f f EXPLAIN EXTENDED SELECT * FROM v1 JOIN v2 ON v1.f = v2.f; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select NULL AS `f`,`v2`.`f` AS `f` from `test`.`t1` `a` straight_join `test`.`t1` `b` join `test`.`v2` where 0 DROP VIEW v1,v2; @@ -19329,11 +19329,11 @@ explain with cte as (select median(f2) over (partition by f1) as k1 from t1 order by f1), cte1 as (select median(f4) over (partition by f1) as k2 from t1) select k1,k2 from cte1, cte; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) -3 DERIVED t1 ALL NULL NULL NULL NULL 5 Using temporary -2 DERIVED t1 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 5 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 Using temporary +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 Using temporary; Using filesort drop table t1; # # MDEV-16104: embedded splittable materialized derived/views @@ -19350,11 +19350,11 @@ t1 AS a2 USING (f); EXPLAIN EXTENDED SELECT * FROM ( SELECT STRAIGHT_JOIN f, COUNT(*) as c FROM v1 GROUP BY f ) AS s; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 7 100.00 -2 DERIVED <derived4> ALL NULL NULL NULL NULL 7 100.00 Using temporary; Using filesort -2 DERIVED a2 eq_ref PRIMARY PRIMARY 4 a1.f 1 100.00 Using index -4 DERIVED t1 index PRIMARY PRIMARY 4 NULL 7 100.00 Using index; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 7 100.00 +2 DERIVED <derived4> NULL ALL NULL NULL NULL NULL 7 100.00 Using temporary; Using filesort +2 DERIVED a2 NULL eq_ref PRIMARY PRIMARY 4 a1.f 1 100.00 Using index +4 DERIVED t1 NULL index PRIMARY PRIMARY 4 NULL 7 100.00 Using index; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `s`.`f` AS `f`,`s`.`c` AS `c` from (/* select#2 */ select straight_join `a2`.`f` AS `f`,count(0) AS `c` from (/* select#4 */ select `test`.`t1`.`f` AS `f`,count(0) AS `c` from `test`.`t1` group by `test`.`t1`.`f`) `a1` join `test`.`t1` `a2` where `a2`.`f` = `a1`.`f` group by `a2`.`f`) `s` SELECT * FROM ( SELECT STRAIGHT_JOIN f, COUNT(*) as c FROM v1 GROUP BY f ) AS s; @@ -19417,11 +19417,11 @@ FROM t3, FROM t1, t2 GROUP BY t1.b,t2.c) dt WHERE t3.d = dt.b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 5 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t3.d 2 100.00 -2 LATERAL DERIVED t1 ref idx_b idx_b 5 test.t3.d 1 100.00 Using index; Using temporary; Using filesort -2 LATERAL DERIVED t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t3.d 2 100.00 +2 LATERAL DERIVED t1 NULL ref idx_b idx_b 5 test.t3.d 1 100.00 Using index; Using temporary; Using filesort +2 LATERAL DERIVED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`d` AS `d`,`dt`.`b` AS `b`,`dt`.`c` AS `c` from `test`.`t3` join (/* select#2 */ select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`b` = `test`.`t3`.`d` group by `test`.`t1`.`b`,`test`.`t2`.`c`) `dt` where `dt`.`b` = `test`.`t3`.`d` DROP TABLE t1,t2,t3; @@ -19452,10 +19452,10 @@ EXPLAIN select * from t1 as u left join (select * from t2 as au group by au.userid) as auditlastlogin on u.id=auditlastlogin.userid; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY u ALL NULL NULL NULL NULL 2 -1 PRIMARY <derived2> ref key0 key0 5 test.u.id 2 -2 DERIVED au ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY u NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <derived2> NULL ref key0 key0 5 test.u.id 2 +2 DERIVED au NULL ALL NULL NULL NULL NULL 4 Using temporary; Using filesort select * from t1 as u left join (select * from t2 as au group by au.userid) as auditlastlogin @@ -19507,11 +19507,11 @@ id a 19 119 20 120 explain extended select id, a from t1 where id in (select id from v1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 20 100.00 -1 PRIMARY <derived3> ref key0 key0 4 test.t1.id 2 100.00 FirstMatch(t1) -3 LATERAL DERIVED t1 eq_ref PRIMARY PRIMARY 4 test.t1.id 1 100.00 -3 LATERAL DERIVED t2 ref ro_id ro_id 4 test.t1.id 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 20 100.00 +1 PRIMARY <derived3> NULL ref key0 key0 4 test.t1.id 2 100.00 FirstMatch(t1) +3 LATERAL DERIVED t1 NULL eq_ref PRIMARY PRIMARY 4 test.t1.id 1 100.00 +3 LATERAL DERIVED t2 NULL ref ro_id ro_id 4 test.t1.id 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`v1`) where `v1`.`id` = `test`.`t1`.`id` select id, a from t1 @@ -19545,11 +19545,11 @@ where id in (select id from (select t1.* from t1 left join t2 on (t1.id = t2.ro_id AND t2.flag = 1) group by t1.id) dt); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 20 100.00 -1 PRIMARY <derived3> ref key0 key0 4 test.t1.id 2 100.00 FirstMatch(t1) -3 LATERAL DERIVED t1 eq_ref PRIMARY PRIMARY 4 test.t1.id 1 100.00 -3 LATERAL DERIVED t2 ref ro_id ro_id 4 test.t1.id 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 20 100.00 +1 PRIMARY <derived3> NULL ref key0 key0 4 test.t1.id 2 100.00 FirstMatch(t1) +3 LATERAL DERIVED t1 NULL eq_ref PRIMARY PRIMARY 4 test.t1.id 1 100.00 +3 LATERAL DERIVED t2 NULL ref ro_id ro_id 4 test.t1.id 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` semi join ((/* select#3 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`ro_id` = `test`.`t1`.`id` and `test`.`t2`.`flag` = 1) where `test`.`t1`.`id` = `test`.`t1`.`id` group by `test`.`t1`.`id`) `dt`) where `dt`.`id` = `test`.`t1`.`id` drop view v1; @@ -19745,13 +19745,13 @@ id a a id 21 2 2 2 explain select * from t1, (select a from t1 cp2 group by a) dt, t3 where dt.a = t1.a and t1.a = t3.id and t1.a in (select a from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY t1 ref a a 5 test.t3.id 1 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY <derived2> ref key0 key0 5 test.t3.id 2 -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 -2 DERIVED cp2 range NULL a 5 NULL 8 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL ref a a 5 test.t3.id 1 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t3.id 2 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 +2 DERIVED cp2 NULL range NULL a 5 NULL 8 Using index for group-by explain format=json select * from t1, (select a from t1 cp2 group by a) dt, t3 where dt.a = t1.a and t1.a = t3.id and t1.a in (select a from t2); EXPLAIN @@ -19853,13 +19853,13 @@ id a a id 21 2 2 2 explain select * from t1, (select a from t1 cp2 group by a) dt, t3 where dt.a = t1.a and t1.a = t3.id and t1.a in (select a from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY t1 ref a a 5 test.t3.id 1 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY <derived2> ref key0 key0 5 test.t3.id 2 -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 -2 LATERAL DERIVED cp2 ref a a 5 test.t1.a 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL ref a a 5 test.t3.id 1 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t3.id 2 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 +2 LATERAL DERIVED cp2 NULL ref a a 5 test.t1.a 1 Using where; Using index explain format=json select * from t1, (select a from t1 cp2 group by a) dt, t3 where dt.a = t1.a and t1.a = t3.id and t1.a in (select a from t2); EXPLAIN @@ -20061,11 +20061,11 @@ ON t3.t1_id = t1.id JOIN (SELECT t1_id FROM t2 WHERE reporting_person = 1 GROUP BY t1_id) tx ON tx.t1_id = t1.id WHERE t1.id BETWEEN 200 AND 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 range t1_id t1_id 5 NULL 47 Using where; Using index -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.t1_id 1 Using index -1 PRIMARY <derived2> ref key0 key0 5 test.t3.t1_id 2 -2 LATERAL DERIVED t2 ref t1_id t1_id 5 test.t1.id 3 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL range t1_id t1_id 5 NULL 47 Using where; Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.t1_id 1 Using index +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t3.t1_id 2 +2 LATERAL DERIVED t2 NULL ref t1_id t1_id 5 test.t1.id 3 Using index condition; Using where EXPLAIN FORMAT=JSON SELECT t1.id FROM t1 JOIN t3 @@ -20275,11 +20275,11 @@ GROUP BY transactions.ledger_id, transaction_items.charge_id ON from_agg_items.charge_id = charges.id AND from_agg_items.ledger_id = charges.from_ledger_id WHERE charges.to_ledger_id = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY charges ALL PRIMARY,fk_charge_from_ledger,fk_charge_to_ledger NULL NULL NULL 20 Using where -1 PRIMARY <derived2> ref key0 key0 17 test.charges.from_ledger_id,test.charges.id 2 -2 LATERAL DERIVED transaction_items ref fk_items_transaction,fk_items_charge fk_items_charge 9 test.charges.id 2 -2 LATERAL DERIVED transactions eq_ref PRIMARY,fk_transactions_ledger PRIMARY 8 test.transaction_items.transaction_id 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY charges NULL ALL PRIMARY,fk_charge_from_ledger,fk_charge_to_ledger NULL NULL NULL 20 Using where +1 PRIMARY <derived2> NULL ref key0 key0 17 test.charges.from_ledger_id,test.charges.id 2 +2 LATERAL DERIVED transaction_items NULL ref fk_items_transaction,fk_items_charge fk_items_charge 9 test.charges.id 2 +2 LATERAL DERIVED transactions NULL eq_ref PRIMARY,fk_transactions_ledger PRIMARY 8 test.transaction_items.transaction_id 1 Using where EXPLAIN FORMAT=JSON SELECT charges.id, charges.from_ledger_id, @@ -20414,11 +20414,11 @@ GROUP BY transactions.ledger_id, transaction_items.charge_id ON from_agg_items.charge_id = charges.id AND from_agg_items.ledger_id = charges.from_ledger_id WHERE charges.to_ledger_id = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY charges ALL PRIMARY,fk_charge_from_ledger,fk_charge_to_ledger NULL NULL NULL 20 Using where -1 PRIMARY <derived2> ref key0 key0 17 test.charges.from_ledger_id,test.charges.id 4 -2 DERIVED transaction_items ALL fk_items_transaction NULL NULL NULL 40 Using temporary; Using filesort -2 DERIVED transactions eq_ref PRIMARY PRIMARY 8 test.transaction_items.transaction_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY charges NULL ALL PRIMARY,fk_charge_from_ledger,fk_charge_to_ledger NULL NULL NULL 20 Using where +1 PRIMARY <derived2> NULL ref key0 key0 17 test.charges.from_ledger_id,test.charges.id 4 +2 DERIVED transaction_items NULL ALL fk_items_transaction NULL NULL NULL 40 Using temporary; Using filesort +2 DERIVED transactions NULL eq_ref PRIMARY PRIMARY 8 test.transaction_items.transaction_id 1 INSERT INTO charges (id, from_ledger_id, to_ledger_id, amount) VALUES (101, 4, 2, 100), (102, 7, 2, 200); set optimizer_switch='split_materialized=on'; @@ -20469,11 +20469,11 @@ GROUP BY transactions.ledger_id, transaction_items.charge_id ON from_agg_items.charge_id = charges.id AND from_agg_items.ledger_id = charges.from_ledger_id WHERE charges.to_ledger_id = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY charges ALL fk_charge_to_ledger NULL NULL NULL 20 Using where -1 PRIMARY <derived2> ref key0 key0 18 test.charges.from_ledger_id,test.charges.id 2 -2 LATERAL DERIVED transaction_items ref fk_items_transaction,fk_items_charge fk_items_charge 9 test.charges.id 2 -2 LATERAL DERIVED transactions eq_ref PRIMARY,fk_transactions_ledger PRIMARY 8 test.transaction_items.transaction_id 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY charges NULL ALL fk_charge_to_ledger NULL NULL NULL 20 Using where +1 PRIMARY <derived2> NULL ref key0 key0 18 test.charges.from_ledger_id,test.charges.id 2 +2 LATERAL DERIVED transaction_items NULL ref fk_items_transaction,fk_items_charge fk_items_charge 9 test.charges.id 2 +2 LATERAL DERIVED transactions NULL eq_ref PRIMARY,fk_transactions_ledger PRIMARY 8 test.transaction_items.transaction_id 1 Using where EXPLAIN FORMAT=JSON SELECT charges.id, charges.from_ledger_id, @@ -20606,11 +20606,11 @@ GROUP BY transactions.ledger_id, transaction_items.charge_id ON from_agg_items.charge_id = charges.id AND from_agg_items.ledger_id = charges.from_ledger_id WHERE charges.to_ledger_id = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY charges ALL fk_charge_to_ledger NULL NULL NULL 20 Using where -1 PRIMARY <derived2> ref key0 key0 18 test.charges.from_ledger_id,test.charges.id 4 -2 DERIVED transaction_items ALL fk_items_transaction NULL NULL NULL 40 Using temporary; Using filesort -2 DERIVED transactions eq_ref PRIMARY PRIMARY 8 test.transaction_items.transaction_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY charges NULL ALL fk_charge_to_ledger NULL NULL NULL 20 Using where +1 PRIMARY <derived2> NULL ref key0 key0 18 test.charges.from_ledger_id,test.charges.id 4 +2 DERIVED transaction_items NULL ALL fk_items_transaction NULL NULL NULL 40 Using temporary; Using filesort +2 DERIVED transactions NULL eq_ref PRIMARY PRIMARY 8 test.transaction_items.transaction_id 1 set optimizer_switch='split_materialized=default'; DROP TABLE transaction_items; DROP TABLE transactions; @@ -20632,10 +20632,10 @@ group by t1.f; select * from v1; f explain select * from v1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found -2 DERIVED NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 0 Const row not found +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 Using temporary drop view v1; drop table t1; # End of 10.4 tests diff --git a/mysql-test/main/derived_opt.result b/mysql-test/main/derived_opt.result index cf0c1cb617f..51ee1c6867c 100644 --- a/mysql-test/main/derived_opt.result +++ b/mysql-test/main/derived_opt.result @@ -28,9 +28,9 @@ a b a b 3 c 3 c 3 c 3 c explain select * from t1 as x1, (select * from t1) as x2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE x1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE x1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) drop table if exists t2,t3; CREATE TABLE t2 (a int not null); insert into t2 values(1); @@ -38,9 +38,9 @@ select * from (select t1.*, t2.a as t2a from t1,t2 where t1.a=t2.a) t1; a b t2a 1 a 1 explain select * from (select t1.*, t2.a as t2a from t1,t2 where t1.a=t2.a) t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where drop table t1, t2; create table t1(a int not null, t char(8), index(a)); SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20; @@ -66,8 +66,8 @@ a t 19 19 20 20 explain select count(*) from t1 as tt1, (select * from t1) as tt2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away drop table t1; create table t1 (mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, matintnum CHAR(6) NOT NULL, test MEDIUMINT UNSIGNED NULL); create table t2 (mat_id MEDIUMINT UNSIGNED NOT NULL, pla_id MEDIUMINT UNSIGNED NOT NULL); @@ -90,17 +90,17 @@ pla_id test 103 2 105 3 explain SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY m2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ref key0 key0 7 test.m2.matintnum 2 -2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort -2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY m2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ref key0 key0 7 test.m2.matintnum 2 +2 DERIVED mp NULL ALL NULL NULL NULL NULL 9 Using temporary; Using filesort +2 DERIVED m1 NULL eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 explain SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY m2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ref key0 key0 7 test.m2.matintnum 2 -2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort -2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY m2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ref key0 key0 7 test.m2.matintnum 2 +2 DERIVED mp NULL ALL NULL NULL NULL NULL 9 Using temporary; Using filesort +2 DERIVED m1 NULL eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 drop table t1,t2; create table t1 (E1 INTEGER UNSIGNED NOT NULL, E2 INTEGER UNSIGNED NOT NULL, E3 INTEGER UNSIGNED NOT NULL, PRIMARY KEY(E1) ); @@ -109,10 +109,10 @@ select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A count(*) 2 explain select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.A.E2 1 Using where -3 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.A.E2 1 Using where +3 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 2 Using where drop table t1; create table t1 (a int); insert into t1 values (1),(2); @@ -123,24 +123,24 @@ a a 1 2 2 2 explain select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 -1 PRIMARY <derived4> ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) -4 DERIVED t1 ALL NULL NULL NULL NULL 2 -5 UNION t1 ALL NULL NULL NULL NULL 2 -NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL -2 DERIVED t1 ALL NULL NULL NULL NULL 2 -3 UNION t1 ALL NULL NULL NULL NULL 2 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 +5 UNION t1 NULL ALL NULL NULL NULL NULL 2 +NULL UNION RESULT <union4,5> NULL ALL NULL NULL NULL NULL NULL +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 +3 UNION t1 NULL ALL NULL NULL NULL NULL 2 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL drop table t1; create table t2 (a int, b int, primary key (a)); insert into t2 values (1,7),(2,7); explain select a from t2 where a>1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using where; Using index explain select a from (select a from t2 where a>1) tt; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using where; Using index drop table t2; create table t1 ( @@ -160,26 +160,26 @@ set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=o set @stmt= ' explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25 ' ; prepare stmt1 from @stmt ; execute stmt1 ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables execute stmt1 ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables deallocate prepare stmt1; drop tables t1,t2; set @@optimizer_switch=@save_optimizer_switch; @@ -193,10 +193,10 @@ CREATE TABLE t2 (a int); INSERT INTO t2 VALUES (3); EXPLAIN SELECT * FROM (SELECT DISTINCT * FROM t2) t, t1 WHERE t1.a = t.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 1 -1 PRIMARY t1 ref a a 5 const 1 Using index -2 DERIVED t2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 1 +1 PRIMARY t1 NULL ref a a 5 const 1 Using index +2 DERIVED t2 NULL system NULL NULL NULL NULL 1 SELECT * FROM (SELECT DISTINCT * FROM t2) t, t1 WHERE t1.a = t.a; a a 3 3 @@ -211,8 +211,8 @@ INSERT INTO t1 VALUES (200, 4, 'aaaa'), (100, 3, 'eee'), (100, 5, 'zzzzz'); EXPLAIN SELECT MAX(b) FROM (SELECT * FROM t1) AS t WHERE a = 100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT MAX(b) FROM (SELECT * FROM t1) AS t WHERE a = 100; MAX(b) 5 @@ -230,10 +230,10 @@ INSERT INTO t2 VALUES CREATE VIEW v1 AS SELECT a, MIN(b) AS b FROM t2 GROUP BY a; EXPLAIN SELECT * FROM v1, t1 WHERE v1.b=t1.a ORDER BY v1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY <derived2> ref key0 key0 5 const 1 Using where; Using filesort -2 DERIVED t2 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY <derived2> NULL ref key0 key0 5 const 1 Using where; Using filesort +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 10 Using temporary; Using filesort SELECT * FROM v1, t1 WHERE v1.b=t1.a ORDER BY v1.a; a b a 188 8 8 @@ -322,15 +322,15 @@ JOIN t2 AS tb ON (ta.pk = tb.pk) JOIN t1 AS tc ON (tb.pk = tc.pk) JOIN t4 AS td ON tc.a = td.a) tu) limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL # -1 PRIMARY tx eq_ref PRIMARY PRIMARY 4 tu.pk # Using index -1 PRIMARY ty eq_ref PRIMARY PRIMARY 4 tu.pk # Using index -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL # -3 DERIVED td system PRIMARY NULL NULL NULL # Using temporary -3 DERIVED tc ref PRIMARY,a a 3 const # -3 DERIVED ta eq_ref PRIMARY PRIMARY 4 test.tc.pk # Using index -3 DERIVED tb eq_ref PRIMARY PRIMARY 4 test.tc.pk # Using index; Distinct +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL # +1 PRIMARY tx NULL eq_ref PRIMARY PRIMARY 4 tu.pk # Using index +1 PRIMARY ty NULL eq_ref PRIMARY PRIMARY 4 tu.pk # Using index +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL # +3 DERIVED td NULL system PRIMARY NULL NULL NULL # Using temporary +3 DERIVED tc NULL ref PRIMARY,a a 3 const # +3 DERIVED ta NULL eq_ref PRIMARY PRIMARY 4 test.tc.pk # Using index +3 DERIVED tb NULL eq_ref PRIMARY PRIMARY 4 test.tc.pk # Using index; Distinct SELECT * FROM t3 AS tX JOIN t2 AS tY ON (tX.pk = tY.pk) WHERE tX.pk IN @@ -411,66 +411,66 @@ create VIEW v25 AS select tab1_v25.f1,tab1_v25.f2 from t1 tab1_v25 join v24 tab2 create VIEW v26 AS select tab1_v26.f1,tab1_v26.f2 from t2 tab1_v26 join v25 tab2 on tab1_v26.f1 = tab2.f1 and tab1_v26.f2 = tab2.f2; create VIEW v27 AS select tab1_v27.f1,tab1_v27.f2 from t0 tab1_v27 join v26 tab2 on tab1_v27.f1 = tab2.f1 and tab1_v27.f2 = tab2.f2; EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tab1_v27 ALL NULL NULL NULL NULL 5 Using where -1 SIMPLE tab1_v26 hash_ALL NULL #hash#$hj 62 test1.tab1_v27.f1,test1.tab1_v27.f2 5 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE tab1_v25 hash_ALL NULL #hash#$hj 31 test1.tab1_v26.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v24 hash_ALL NULL #hash#$hj 60 test1.tab1_v25.f1,test1.tab1_v25.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v23 hash_ALL NULL #hash#$hj 62 test1.tab1_v24.f1,test1.tab1_v24.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v22 hash_ALL NULL #hash#$hj 31 test1.tab1_v23.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v21 hash_ALL NULL #hash#$hj 60 test1.tab1_v22.f1,test1.tab1_v22.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v20 hash_ALL NULL #hash#$hj 62 test1.tab1_v21.f1,test1.tab1_v21.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v19 hash_ALL NULL #hash#$hj 31 test1.tab1_v20.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v18 hash_ALL NULL #hash#$hj 60 test1.tab1_v19.f1,test1.tab1_v19.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v17 hash_ALL NULL #hash#$hj 62 test1.tab1_v18.f1,test1.tab1_v18.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v16 hash_ALL NULL #hash#$hj 31 test1.tab1_v17.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v15 hash_ALL NULL #hash#$hj 60 test1.tab1_v16.f1,test1.tab1_v16.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v14 hash_ALL NULL #hash#$hj 62 test1.tab1_v15.f1,test1.tab1_v15.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v13 hash_ALL NULL #hash#$hj 31 test1.tab1_v14.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v12 hash_ALL NULL #hash#$hj 60 test1.tab1_v13.f1,test1.tab1_v13.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v11 hash_ALL NULL #hash#$hj 62 test1.tab1_v12.f1,test1.tab1_v12.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v10 hash_ALL NULL #hash#$hj 31 test1.tab1_v11.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v9 hash_ALL NULL #hash#$hj 60 test1.tab1_v10.f1,test1.tab1_v10.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v8 hash_ALL NULL #hash#$hj 62 test1.tab1_v9.f1,test1.tab1_v9.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v7 hash_ALL NULL #hash#$hj 31 test1.tab1_v8.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v6 hash_ALL NULL #hash#$hj 60 test1.tab1_v7.f1,test1.tab1_v7.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v5 hash_ALL NULL #hash#$hj 62 test1.tab1_v6.f1,test1.tab1_v6.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v4 hash_ALL NULL #hash#$hj 31 test1.tab1_v5.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v3 hash_ALL NULL #hash#$hj 60 test1.tab1_v4.f1,test1.tab1_v4.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v2 hash_ALL NULL #hash#$hj 62 test1.tab1_v3.f1,test1.tab1_v3.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v1 hash_ALL NULL #hash#$hj 31 test1.tab1_v2.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t1 hash_ALL NULL #hash#$hj 84 test1.tab1_v1.f1,test1.tab1_v1.f2 5 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE tab1_v27 NULL ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE tab1_v26 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v27.f1,test1.tab1_v27.f2 5 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE tab1_v25 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v26.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v24 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v25.f1,test1.tab1_v25.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v23 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v24.f1,test1.tab1_v24.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v22 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v23.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v21 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v22.f1,test1.tab1_v22.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v20 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v21.f1,test1.tab1_v21.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v19 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v20.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v18 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v19.f1,test1.tab1_v19.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v17 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v18.f1,test1.tab1_v18.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v16 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v17.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v15 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v16.f1,test1.tab1_v16.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v14 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v15.f1,test1.tab1_v15.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v13 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v14.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v12 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v13.f1,test1.tab1_v13.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v11 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v12.f1,test1.tab1_v12.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v10 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v11.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v9 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v10.f1,test1.tab1_v10.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v8 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v9.f1,test1.tab1_v9.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v7 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v8.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v6 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v7.f1,test1.tab1_v7.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v5 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v6.f1,test1.tab1_v6.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v4 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v5.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v3 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v4.f1,test1.tab1_v4.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v2 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v3.f1,test1.tab1_v3.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v1 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v2.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t1 NULL hash_ALL NULL #hash#$hj 84 test1.tab1_v1.f1,test1.tab1_v1.f2 5 Using where; Using join buffer (incremental, BNLH join) # This used to hang forever: EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tab1_v27 ALL NULL NULL NULL NULL 5 Using where -1 SIMPLE tab1_v26 hash_ALL NULL #hash#$hj 62 test1.tab1_v27.f1,test1.tab1_v27.f2 5 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE tab1_v25 hash_ALL NULL #hash#$hj 31 test1.tab1_v26.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v24 hash_ALL NULL #hash#$hj 60 test1.tab1_v25.f1,test1.tab1_v25.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v23 hash_ALL NULL #hash#$hj 62 test1.tab1_v24.f1,test1.tab1_v24.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v22 hash_ALL NULL #hash#$hj 31 test1.tab1_v23.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v21 hash_ALL NULL #hash#$hj 60 test1.tab1_v22.f1,test1.tab1_v22.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v20 hash_ALL NULL #hash#$hj 62 test1.tab1_v21.f1,test1.tab1_v21.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v19 hash_ALL NULL #hash#$hj 31 test1.tab1_v20.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v18 hash_ALL NULL #hash#$hj 60 test1.tab1_v19.f1,test1.tab1_v19.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v17 hash_ALL NULL #hash#$hj 62 test1.tab1_v18.f1,test1.tab1_v18.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v16 hash_ALL NULL #hash#$hj 31 test1.tab1_v17.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v15 hash_ALL NULL #hash#$hj 60 test1.tab1_v16.f1,test1.tab1_v16.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v14 hash_ALL NULL #hash#$hj 62 test1.tab1_v15.f1,test1.tab1_v15.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v13 hash_ALL NULL #hash#$hj 31 test1.tab1_v14.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v12 hash_ALL NULL #hash#$hj 60 test1.tab1_v13.f1,test1.tab1_v13.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v11 hash_ALL NULL #hash#$hj 62 test1.tab1_v12.f1,test1.tab1_v12.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v10 hash_ALL NULL #hash#$hj 31 test1.tab1_v11.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v9 hash_ALL NULL #hash#$hj 60 test1.tab1_v10.f1,test1.tab1_v10.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v8 hash_ALL NULL #hash#$hj 62 test1.tab1_v9.f1,test1.tab1_v9.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v7 hash_ALL NULL #hash#$hj 31 test1.tab1_v8.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v6 hash_ALL NULL #hash#$hj 60 test1.tab1_v7.f1,test1.tab1_v7.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v5 hash_ALL NULL #hash#$hj 62 test1.tab1_v6.f1,test1.tab1_v6.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v4 hash_ALL NULL #hash#$hj 31 test1.tab1_v5.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v3 hash_ALL NULL #hash#$hj 60 test1.tab1_v4.f1,test1.tab1_v4.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v2 hash_ALL NULL #hash#$hj 62 test1.tab1_v3.f1,test1.tab1_v3.f2 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE tab1_v1 hash_ALL NULL #hash#$hj 31 test1.tab1_v2.f1 5 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t1 hash_ALL NULL #hash#$hj 84 test1.tab1_v1.f1,test1.tab1_v1.f2 5 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE tab1_v27 NULL ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE tab1_v26 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v27.f1,test1.tab1_v27.f2 5 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE tab1_v25 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v26.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v24 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v25.f1,test1.tab1_v25.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v23 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v24.f1,test1.tab1_v24.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v22 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v23.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v21 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v22.f1,test1.tab1_v22.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v20 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v21.f1,test1.tab1_v21.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v19 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v20.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v18 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v19.f1,test1.tab1_v19.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v17 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v18.f1,test1.tab1_v18.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v16 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v17.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v15 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v16.f1,test1.tab1_v16.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v14 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v15.f1,test1.tab1_v15.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v13 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v14.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v12 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v13.f1,test1.tab1_v13.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v11 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v12.f1,test1.tab1_v12.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v10 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v11.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v9 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v10.f1,test1.tab1_v10.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v8 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v9.f1,test1.tab1_v9.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v7 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v8.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v6 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v7.f1,test1.tab1_v7.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v5 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v6.f1,test1.tab1_v6.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v4 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v5.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v3 NULL hash_ALL NULL #hash#$hj 60 test1.tab1_v4.f1,test1.tab1_v4.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v2 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v3.f1,test1.tab1_v3.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v1 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v2.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t1 NULL hash_ALL NULL #hash#$hj 84 test1.tab1_v1.f1,test1.tab1_v1.f2 5 Using where; Using join buffer (incremental, BNLH join) use test; drop database test1; set join_cache_level=@tmp_jcl; @@ -497,10 +497,10 @@ t1 join (select * from t2 order by a limit 1000) as D1 where D1.a= t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 10 -2 DERIVED t2 ALL NULL NULL NULL NULL 100 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.a 10 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 100 Using filesort set join_cache_level=@tmp_jcl; set optimizer_switch=@tmp_os; drop table t1, t2; @@ -533,10 +533,10 @@ LEFT JOIN (SELECT id, sum(amount) total_amt FROM t1 GROUP BY id) AS t ON t2.id=t.id WHERE t2.id < 3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition -1 PRIMARY <derived2> ref key0 key0 5 test.t2.id 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 Using index condition +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.id 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 Using temporary; Using filesort set join_cache_level=default; set optimizer_switch= @save_optimizer_switch; DROP TABLE t1,t2; diff --git a/mysql-test/main/derived_opt.test b/mysql-test/main/derived_opt.test index dee424559ee..412a9e9623a 100644 --- a/mysql-test/main/derived_opt.test +++ b/mysql-test/main/derived_opt.test @@ -247,7 +247,7 @@ INSERT INTO t4 VALUES ('CD'); set @@tmp_table_size=8192; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM t3 AS tx JOIN t2 AS ty ON (tx.pk = ty.pk) WHERE diff --git a/mysql-test/main/derived_split_innodb.result b/mysql-test/main/derived_split_innodb.result index 74876836a53..810ff43f878 100644 --- a/mysql-test/main/derived_split_innodb.result +++ b/mysql-test/main/derived_split_innodb.result @@ -18,10 +18,10 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT t1.n1 FROM t1, (SELECT n1, n2 FROM t1 WHERE c1 = 'a' GROUP BY n1) as t WHERE t.n1 = t1.n1 AND t.n2 = t1.n2 AND c1 = 'a' GROUP BY n1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref c1,n1_c1_n2 c1 1 const 2 Using index condition; Using where; Using temporary; Using filesort -1 PRIMARY <derived2> ref key0 key0 8 test.t1.n1,test.t1.n2 2 -2 LATERAL DERIVED t1 ref c1,n1_c1_n2 n1_c1_n2 4 test.t1.n1 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref c1,n1_c1_n2 c1 1 const 2 Using index condition; Using where; Using temporary; Using filesort +1 PRIMARY <derived2> NULL ref key0 key0 8 test.t1.n1,test.t1.n2 2 +2 LATERAL DERIVED t1 NULL ref c1,n1_c1_n2 n1_c1_n2 4 test.t1.n1 1 Using where; Using index SELECT t1.n1 FROM t1, (SELECT n1, n2 FROM t1 WHERE c1 = 'a' GROUP BY n1) as t WHERE t.n1 = t1.n1 AND t.n2 = t1.n2 AND c1 = 'a' GROUP BY n1; n1 @@ -47,12 +47,12 @@ WHERE t3.i3=t1.id1 AND t2.id2=t1.id2 GROUP BY t3.id3, t1.id2) AS t, t2 WHERE t2.id2=t.id2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.id2 2 -2 DERIVED t3 ALL NULL NULL NULL NULL 1 Using where; Using temporary; Using filesort -2 DERIVED t1 eq_ref PRIMARY,id2 PRIMARY 4 test.t3.i3 1 -2 DERIVED t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.id2 2 +2 DERIVED t3 NULL ALL NULL NULL NULL NULL 1 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL eq_ref PRIMARY,id2 PRIMARY 4 test.t3.i3 1 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) SELECT id3 FROM (SELECT t3.id3, t2.i2, t1.id2 FROM t3,t1,t2 WHERE t3.i3=t1.id1 AND t2.id2=t1.id2 @@ -97,10 +97,10 @@ LEFT JOIN (SELECT id, sum(amount) total_amt FROM t1 GROUP BY id) AS t ON t2.id=t.id WHERE t2.id < 3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.id 2 -2 LATERAL DERIVED t1 eq_ref PRIMARY PRIMARY 4 test.t2.id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.id 2 +2 LATERAL DERIVED t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.id 1 set join_cache_level=default; DROP TABLE t1,t2; # @@ -127,21 +127,21 @@ from t1 left join (v1 join t1 as t on v1.f1=t.f1 and t.f2 = null) on t1.f1=t.f1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t const f2 NULL NULL NULL 1 Impossible ON condition -1 PRIMARY <derived2> const key1 NULL NULL NULL 1 Impossible ON condition -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -2 DERIVED t2 ALL PRIMARY NULL NULL NULL 3 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL const f2 NULL NULL NULL 1 Impossible ON condition +1 PRIMARY <derived2> NULL const key1 NULL NULL NULL 1 Impossible ON condition +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +2 DERIVED t2 NULL ALL PRIMARY NULL NULL NULL 3 Using temporary; Using filesort set statement optimizer_switch='split_materialized=off' for explain select t.f2 from t1 left join (v1 join t1 as t on v1.f1=t.f1 and t.f2 = null) on t1.f1=t.f1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t const f2 NULL NULL NULL 1 Impossible ON condition -1 PRIMARY <derived3> const key1 NULL NULL NULL 1 Impossible ON condition -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -3 DERIVED t2 index NULL PRIMARY 4 NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL const f2 NULL NULL NULL 1 Impossible ON condition +1 PRIMARY <derived3> NULL const key1 NULL NULL NULL 1 Impossible ON condition +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +3 DERIVED t2 NULL index NULL PRIMARY 4 NULL 3 drop view v1; drop table t1,t2; # @@ -160,11 +160,11 @@ t1 JOIN (SELECT t1.a, t1.b FROM t1, t2 WHERE t1.b = t2.c GROUP BY t1.a, t1.b) as dt WHERE t1.a = dt.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index a,a_2 a_2 10 NULL 6 Using where; Using index -1 PRIMARY <derived3> ref key0 key0 5 test.t1.a 2 -3 DERIVED t1 index NULL a_2 10 NULL 6 Using where; Using index -3 DERIVED t2 ref c c 5 test.t1.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index a,a_2 a_2 10 NULL 6 Using where; Using index +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t1.a 2 +3 DERIVED t1 NULL index NULL a_2 10 NULL 6 Using where; Using index +3 DERIVED t2 NULL ref c c 5 test.t1.b 1 Using index set statement optimizer_switch='split_materialized=on' for EXPLAIN SELECT * FROM @@ -172,11 +172,11 @@ t1 JOIN (SELECT t1.a, t1.b FROM t1, t2 WHERE t1.b = t2.c GROUP BY t1.a, t1.b) as dt WHERE t1.a = dt.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index a,a_2 a_2 10 NULL 6 Using where; Using index -1 PRIMARY <derived3> ref key0 key0 5 test.t1.a 2 -3 LATERAL DERIVED t1 ref a,a_2 a 5 test.t1.a 1 Using where; Using temporary; Using filesort -3 LATERAL DERIVED t2 ref c c 5 test.t1.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index a,a_2 a_2 10 NULL 6 Using where; Using index +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t1.a 2 +3 LATERAL DERIVED t1 NULL ref a,a_2 a 5 test.t1.a 1 Using where; Using temporary; Using filesort +3 LATERAL DERIVED t2 NULL ref c c 5 test.t1.b 1 Using index DROP TABLE t1, t2; # # Bug mdev-25714: usage non-splitting covering index is cheaper than @@ -206,11 +206,11 @@ from t1, (select itemid, max(id) as id from t3 where userid = 1 group by itemid) dt, t2 where t1.id = dt.id and t1.itemid = dt.itemid and t2.id=t1.itemid; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 -1 PRIMARY <derived2> ref key1 key1 4 test.t2.id 2 -1 PRIMARY t1 ALL idx NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -2 DERIVED t3 ref idx1,idx2 idx1 4 const 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 +1 PRIMARY <derived2> NULL ref key1 key1 4 test.t2.id 2 +1 PRIMARY t1 NULL ALL idx NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +2 DERIVED t3 NULL ref idx1,idx2 idx1 4 const 5 Using where; Using index select t1.id, t1.itemid, dt.id, t2.id from t1, (select itemid, max(id) as id from t3 where userid = 1 group by itemid) dt, @@ -225,11 +225,11 @@ from t1, (select itemid, max(id) as id from t3 where userid = 1 group by itemid) dt, t2 where t1.id = dt.id and t1.itemid = dt.itemid and t2.id=t1.itemid; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 -1 PRIMARY <derived2> ref key1 key1 4 test.t2.id 2 -1 PRIMARY t1 ALL idx NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -2 DERIVED t3 ref idx1 idx1 4 const 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 +1 PRIMARY <derived2> NULL ref key1 key1 4 test.t2.id 2 +1 PRIMARY t1 NULL ALL idx NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +2 DERIVED t3 NULL ref idx1 idx1 4 const 5 Using where; Using index select t1.id, t1.itemid, dt.id, t2.id from t1, (select itemid, max(id) as id from t3 where userid = 1 group by itemid) dt, @@ -271,20 +271,20 @@ from t3 join (select a, c, max(b) max, min(b) min from t4 group by a,c) t on t3.a=t.a and t3.c=t.c where t3.b > 15; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 range idx_b idx_b 5 NULL 2 Using index condition; Using where -1 PRIMARY <derived2> ref key0 key0 133 test.t3.a,test.t3.c 2 -2 LATERAL DERIVED t4 ref idx idx 133 test.t3.a,test.t3.c 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL range idx_b idx_b 5 NULL 2 Using index condition; Using where +1 PRIMARY <derived2> NULL ref key0 key0 133 test.t3.a,test.t3.c 2 +2 LATERAL DERIVED t4 NULL ref idx idx 133 test.t3.a,test.t3.c 1 # ... and if one adds WITH ROLLUP, then LATERAL DERIVED is no longer used: explain select t3.a,t3.c,t.max,t.min from t3 join (select a, c, max(b) max, min(b) min from t4 group by a,c with rollup) t on t3.a=t.a and t3.c=t.c where t3.b > 15; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 range idx_b idx_b 5 NULL 2 Using index condition; Using where -1 PRIMARY <derived2> ref key0 key0 133 test.t3.a,test.t3.c 4 -2 DERIVED t4 ALL NULL NULL NULL NULL 40 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL range idx_b idx_b 5 NULL 2 Using index condition; Using where +1 PRIMARY <derived2> NULL ref key0 key0 133 test.t3.a,test.t3.c 4 +2 DERIVED t4 NULL ALL NULL NULL NULL NULL 40 Using filesort drop table t3, t4; # End of 10.3 tests SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent; diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result index ed596d10205..e7562a4f575 100644 --- a/mysql-test/main/derived_view.result +++ b/mysql-test/main/derived_view.result @@ -16,8 +16,8 @@ Tests: for merged derived tables explain for simple derived explain select * from (select * from t1) tt; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 select * from (select * from t1) tt; f1 f11 1 1 @@ -33,9 +33,9 @@ f1 f11 19 19 explain for multitable derived explain extended select * from (select * from t1 join t2 on f1=f2) tt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`f2` = `test`.`t1`.`f1` select * from (select * from t1 join t2 on f1=f2) tt; @@ -46,8 +46,8 @@ f1 f11 f2 f22 explain for derived with where explain extended select * from (select * from t1 where f1 in (2,3)) tt where f11=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f11` = 2 and `test`.`t1`.`f1` in (2,3) select * from (select * from t1 where f1 in (2,3)) tt where f11=2; @@ -57,9 +57,9 @@ join of derived explain extended select * from (select * from t1 where f1 in (2,3)) tt join (select * from t1 where f1 in (1,2)) aa on tt.f1=aa.f1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` join `test`.`t1` where `test`.`t1`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`f1` in (1,2) and `test`.`t1`.`f1` in (2,3) select * from (select * from t1 where f1 in (2,3)) tt join @@ -69,8 +69,8 @@ f1 f11 f1 f11 flush status; explain extended select * from (select * from t1 where f1 in (2,3)) tt where f11=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f11` = 2 and `test`.`t1`.`f1` in (2,3) show status like 'Handler_read%'; @@ -106,8 +106,8 @@ create view v3 as select * from t1 where f1 in (2,3); create view v4 as select * from t2 where f2 in (2,3); explain for simple views explain extended select * from v1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 100.00 Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` select * from v1; @@ -125,9 +125,9 @@ f1 f11 19 19 explain for multitable views explain extended select * from v2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`f2` = `test`.`t1`.`f1` select * from v2; @@ -137,8 +137,8 @@ f1 f11 f2 f22 2 2 2 2 explain for views with where explain extended select * from v3 where f11 in (1,3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f11` in (1,3) and `test`.`t1`.`f1` in (2,3) select * from v3 where f11 in (1,3); @@ -147,9 +147,9 @@ f1 f11 explain for joined views explain extended select * from v3 join v4 on f1=f2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`f2` = `test`.`t1`.`f1` and `test`.`t1`.`f1` in (2,3) and `test`.`t1`.`f1` in (2,3) select * from v3 join v4 on f1=f2; @@ -158,8 +158,8 @@ f1 f11 f2 f22 2 2 2 2 flush status; explain extended select * from v4 where f2 in (1,3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 11 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where `test`.`t2`.`f2` in (1,3) and `test`.`t2`.`f2` in (2,3) show status like 'Handler_read%'; @@ -191,9 +191,9 @@ Handler_read_rnd_next 12 for materialized derived tables explain for simple derived explain extended select * from (select * from t1 group by f1) tt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 11 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (/* select#2 */ select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` group by `test`.`t1`.`f1`) `tt` select * from (select * from t1 having f1=f1) tt; @@ -212,10 +212,10 @@ f1 f11 explain showing created indexes explain extended select * from t1 join (select * from t2 group by f2) tt on f1=f2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 11 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.f1 2 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.f1 2 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`tt`.`f2` AS `f2`,`tt`.`f22` AS `f22` from `test`.`t1` join (/* select#2 */ select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` group by `test`.`t2`.`f2`) `tt` where `tt`.`f2` = `test`.`t1`.`f1` select * from t1 join (select * from t2 group by f2) tt on f1=f2; @@ -226,10 +226,10 @@ f1 f11 f2 f22 explain showing late materialization flush status; explain select * from t1 join (select * from t2 group by f2) tt on f1=f2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 11 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.f1 2 -2 DERIVED t2 ALL NULL NULL NULL NULL 11 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 11 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.f1 2 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 11 Using temporary; Using filesort show status like 'Handler_read%'; Variable_name Value Handler_read_first 0 @@ -266,9 +266,9 @@ create view v3 as select t1.f1,t1.f11 from t1 join t1 as t11 where t1.f1=t11.f1 having t1.f1<100; explain for simple derived explain extended select * from v1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 11 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `v1`.`f1` AS `f1`,`v1`.`f11` AS `f11` from `test`.`v1` select * from v1; @@ -286,10 +286,10 @@ f1 f11 19 19 explain showing created indexes explain extended select * from t1 join v2 on f1=f2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 11 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.f1 2 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.f1 2 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`v2`.`f2` AS `f2`,`v2`.`f22` AS `f22` from `test`.`t1` join `test`.`v2` where `v2`.`f2` = `test`.`t1`.`f1` select * from t1 join v2 on f1=f2; @@ -299,14 +299,14 @@ f1 f11 f2 f22 3 3 3 3 explain extended select * from t1,v3 as v31,v3 where t1.f1=v31.f1 and t1.f1=v3.f1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 11 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.f1 10 100.00 -1 PRIMARY <derived3> ref key0 key0 5 test.t1.f1 10 100.00 -3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 -3 DERIVED t11 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 -2 DERIVED t11 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.f1 10 100.00 +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t1.f1 10 100.00 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 +3 DERIVED t11 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 +2 DERIVED t11 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`v31`.`f1` AS `f1`,`v31`.`f11` AS `f11`,`v3`.`f1` AS `f1`,`v3`.`f11` AS `f11` from `test`.`t1` join `test`.`v3` `v31` join `test`.`v3` where `v31`.`f1` = `test`.`t1`.`f1` and `v3`.`f1` = `test`.`t1`.`f1` flush status; @@ -337,10 +337,10 @@ Handler_read_rnd_next 60 explain showing late materialization flush status; explain select * from t1 join v2 on f1=f2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 11 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.f1 2 -2 DERIVED t2 ALL NULL NULL NULL NULL 11 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 11 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.f1 2 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 11 Using temporary; Using filesort show status like 'Handler_read%'; Variable_name Value Handler_read_first 0 @@ -370,10 +370,10 @@ Handler_read_rnd 11 Handler_read_rnd_deleted 0 Handler_read_rnd_next 36 explain extended select * from v1 join v4 on f1=f2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 11 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.f2 2 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 11 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.f2 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `v1`.`f1` AS `f1`,`v1`.`f11` AS `f11`,`test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`v1` join `test`.`t2` where `v1`.`f1` = `test`.`t2`.`f2` and `test`.`t2`.`f2` in (2,3) explain format=json select * from v1 join v4 on f1=f2; @@ -435,8 +435,8 @@ f1 f11 f2 f22 merged derived in merged derived explain extended select * from (select * from (select * from t1 where f1 < 7) tt where f1 > 2) zz; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` < 7 select * from (select * from @@ -447,9 +447,9 @@ f1 f11 materialized derived in merged derived explain extended select * from (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) zz; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 11 100.00 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 11 100.00 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (/* select#3 */ select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 group by `test`.`t1`.`f1`) `tt` where `tt`.`f1` > 2 select * from (select * from @@ -460,9 +460,9 @@ f1 f11 merged derived in materialized derived explain extended select * from (select * from (select * from t1 where f1 < 7) tt where f1 > 2 group by f1) zz; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 11 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `zz`.`f1` AS `f1`,`zz`.`f11` AS `f11` from (/* select#2 */ select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` < 7 group by `test`.`t1`.`f1`) `zz` select * from (select * from @@ -473,10 +473,10 @@ f1 f11 materialized derived in materialized derived explain extended select * from (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) zz; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11 100.00 -2 DERIVED <derived3> ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 11 100.00 +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `zz`.`f1` AS `f1`,`zz`.`f11` AS `f11` from (/* select#2 */ select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (/* select#3 */ select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 group by `test`.`t1`.`f1`) `tt` where `tt`.`f1` > 2 group by `tt`.`f1`) `zz` explain format=json select * from (select * from @@ -550,11 +550,11 @@ explain extended select * from join (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) z on x.f1 = z.f1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 11 100.00 Using where -1 PRIMARY <derived5> ref key0 key0 5 tt.f1 2 100.00 -5 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 11 100.00 Using where +1 PRIMARY <derived5> NULL ref key0 key0 5 tt.f1 2 100.00 +5 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11`,`tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (/* select#3 */ select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` > 2 group by `test`.`t1`.`f1`) `tt` join (/* select#5 */ select `t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` where `t1`.`f1` < 7 and `t1`.`f1` > 2 and `t1`.`f1` > 2 group by `t1`.`f1`) `tt` where `tt`.`f1` = `tt`.`f1` and `tt`.`f1` > 2 and `tt`.`f1` > 2 explain format=json select * from @@ -663,9 +663,9 @@ join (select * from (select * from t1 where f1 < 7 ) tt where f1 > 2 ) z on x.f1 = z.f1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11`,`t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` join `test`.`t1` where `t1`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 and `test`.`t1`.`f1` < 7 select * from @@ -687,13 +687,13 @@ join (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) z on x.f1 = z.f1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11 100.00 Using where -1 PRIMARY <derived4> ref key0 key0 5 x.f1 2 100.00 -4 DERIVED <derived5> ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort -5 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort -2 DERIVED <derived3> ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort -3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 11 100.00 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 x.f1 2 100.00 +4 DERIVED <derived5> NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort +5 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `x`.`f1` AS `f1`,`x`.`f11` AS `f11`,`z`.`f1` AS `f1`,`z`.`f11` AS `f11` from (/* select#2 */ select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (/* select#3 */ select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f11` AS `f11` from `test`.`t1` where `test`.`t1`.`f1` < 7 and `test`.`t1`.`f1` > 2 group by `test`.`t1`.`f1`) `tt` where `tt`.`f1` > 2 group by `tt`.`f1`) `x` join (/* select#4 */ select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (/* select#5 */ select `t1`.`f1` AS `f1`,`t1`.`f11` AS `f11` from `test`.`t1` where `t1`.`f1` < 7 and `t1`.`f1` > 2 group by `t1`.`f1`) `tt` where `tt`.`f1` > 2 group by `tt`.`f1`) `z` where `z`.`f1` = `x`.`f1` explain format=json select * from @@ -830,9 +830,9 @@ f1 f11 f1 f11 merged view in materialized derived explain extended select * from (select * from v4 group by 1) tt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 11 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `tt`.`f2` AS `f2`,`tt`.`f22` AS `f22` from (/* select#2 */ select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where `test`.`t2`.`f2` in (2,3) group by 1) `tt` select * from (select * from v4 group by 1) tt; @@ -842,9 +842,9 @@ f2 f22 materialized view in merged derived explain extended select * from ( select * from v1 where f1 < 7) tt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 11 100.00 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 11 100.00 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `v1`.`f1` AS `f1`,`v1`.`f11` AS `f11` from `test`.`v1` where `v1`.`f1` < 7 explain format=json @@ -896,8 +896,8 @@ f1 f11 merged view in a merged view in a merged derived create view v6 as select * from v4 where f2 < 7; explain extended select * from (select * from v6) tt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 11 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 11 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22` from `test`.`t2` where `test`.`t2`.`f2` < 7 and `test`.`t2`.`f2` in (2,3) select * from (select * from v6) tt; @@ -907,10 +907,10 @@ f2 f22 materialized view in a merged view in a materialized derived create view v7 as select * from v1; explain extended select * from (select * from v7 group by 1) tt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11 100.00 -2 DERIVED <derived4> ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort -4 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 11 100.00 +2 DERIVED <derived4> NULL ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `tt`.`f1` AS `f1`,`tt`.`f11` AS `f11` from (/* select#2 */ select `v1`.`f1` AS `f1`,`v1`.`f11` AS `f11` from `test`.`v1` group by 1) `tt` select * from (select * from v7 group by 1) tt; @@ -928,10 +928,10 @@ f1 f11 19 19 join of above two explain extended select * from v6 join v7 on f2=f1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 11 100.00 Using where -1 PRIMARY <derived5> ref key0 key0 5 test.t2.f2 2 100.00 -5 DERIVED t1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 11 100.00 Using where +1 PRIMARY <derived5> NULL ref key0 key0 5 test.t2.f2 2 100.00 +5 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`f2` AS `f2`,`test`.`t2`.`f22` AS `f22`,`v1`.`f1` AS `f1`,`v1`.`f11` AS `f11` from `test`.`t2` join `test`.`v1` where `v1`.`f1` = `test`.`t2`.`f2` and `test`.`t2`.`f2` < 7 and `test`.`t2`.`f2` in (2,3) explain format=json select * from v6 join v7 on f2=f1; @@ -992,11 +992,11 @@ f2 f22 f1 f11 2 2 2 2 test two keys explain select * from t1 join (select * from t2 group by f2) tt on t1.f1=tt.f2 join t1 xx on tt.f22=xx.f1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 11 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.f1 2 -1 PRIMARY xx ALL NULL NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) -2 DERIVED t2 ALL NULL NULL NULL NULL 11 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 11 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.f1 2 +1 PRIMARY xx NULL ALL NULL NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 11 Using temporary; Using filesort select * from t1 join (select * from t2 group by f2) tt on t1.f1=tt.f2 join t1 xx on tt.f22=xx.f1; f1 f11 f2 f22 f1 f11 1 1 1 1 1 1 @@ -1017,10 +1017,10 @@ INSERT INTO t2 VALUES (149), (NULL), (224); CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; EXPLAIN SELECT * FROM v1 JOIN t2 ON v1.f1 = t2.f1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index f1 f1 5 NULL 3 Using where; Using index -1 PRIMARY <derived2> ref key0 key0 5 test.t2.f1 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index f1 f1 5 NULL 3 Using where; Using index +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.f1 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 4 SELECT * FROM v1 JOIN t2 ON v1.f1 = t2.f1; f1 f1 149 149 @@ -1069,43 +1069,43 @@ MIN(a) 5 EXPLAIN SELECT MIN(a) FROM t1 WHERE a >= 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT MIN(a) FROM (SELECT * FROM t1) t WHERE a >= 5; MIN(a) 5 EXPLAIN SELECT MIN(a) FROM(SELECT * FROM t1) t WHERE a >= 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT MIN(a) FROM v1 WHERE a >= 5; MIN(a) 5 EXPLAIN SELECT MIN(a) FROM v1 WHERE a >= 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT MAX(b) FROM t1 WHERE a=7 AND b<75; MAX(b) 74 EXPLAIN SELECT MAX(b) FROM t1 WHERE a=7 AND b<75; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT MAX(b) FROM (SELECT * FROM t1) t WHERE a=7 AND b<75; MAX(b) 74 EXPLAIN SELECT MAX(b) FROM (SELECT * FROM t1) t WHERE a=7 AND b<75; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT MAX(b) FROM v1 WHERE a=7 AND b<75; MAX(b) 74 EXPLAIN SELECT MAX(b) FROM v1 WHERE a=7 AND b<75; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away DROP VIEW v1; DROP TABLE t1; # @@ -1122,10 +1122,10 @@ EXPLAIN EXTENDED SELECT t.a FROM t1 LEFT JOIN (t2 t JOIN t3 ON t3.b > 5) ON t.a >= 1 GROUP BY t.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort -1 SIMPLE t ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` `t` join `test`.`t3`) on(`test`.`t`.`a` >= 1 and `test`.`t3`.`b` > 5) where 1 group by `test`.`t`.`a` SELECT t.a FROM t1 LEFT JOIN @@ -1137,10 +1137,10 @@ EXPLAIN EXTENDED SELECT t.a FROM t1 LEFT JOIN (( SELECT * FROM t2 ) t JOIN t3 ON t3.b > 5) ON t.a >= 1 GROUP BY t.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`a` >= 1 and `test`.`t3`.`b` > 5) where 1 group by `test`.`t2`.`a` SELECT t.a FROM t1 LEFT JOIN @@ -1153,10 +1153,10 @@ EXPLAIN EXTENDED SELECT t.a FROM t1 LEFT JOIN (v1 t JOIN t3 ON t3.b > 5) ON t.a >= 1 GROUP BY t.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`a` >= 1 and `test`.`t3`.`b` > 5) where 1 group by `test`.`t2`.`a` SELECT t.a FROM t1 LEFT JOIN @@ -1180,11 +1180,11 @@ INSERT INTO t3 VALUES CREATE VIEW v1 AS SELECT a, MIN(b) AS b FROM t3 GROUP BY a; EXPLAIN SELECT * FROM t1, t2, v1 WHERE t2.a=t1.a AND t2.a=v1.a AND t2.a=v1.b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ref a a 4 const 1 Using index -1 PRIMARY <derived2> ref key0 key0 8 const,const 1 -2 DERIVED t3 ALL NULL NULL NULL NULL 12 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ref a a 4 const 1 Using index +1 PRIMARY <derived2> NULL ref key0 key0 8 const,const 1 +2 DERIVED t3 NULL ALL NULL NULL NULL NULL 12 Using temporary; Using filesort SELECT * FROM t1, t2, v1 WHERE t2.a=t1.a AND t2.a=v1.a AND t2.a=v1.b; a a a b c c c c @@ -1214,11 +1214,11 @@ CREATE VIEW v1 AS SELECT a, MAX(b) AS b FROM t1 GROUP BY a; EXPLAIN EXTENDED SELECT * FROM t3 WHERE t3.a IN (SELECT v1.a FROM v1, t2 WHERE t2.a = v1.b); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where -2 DEPENDENT SUBQUERY <derived3> ref key1 key1 5 func 2 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -3 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +2 DEPENDENT SUBQUERY <derived3> NULL ref key1 key1 5 func 2 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <expr_cache><`test`.`t3`.`a`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(/* select#2 */ select `v1`.`a` from `test`.`v1` join `test`.`t2` where `test`.`t2`.`a` = `v1`.`b` and <cache>(`test`.`t3`.`a`) = `v1`.`a`))) SELECT * FROM t3 @@ -1247,12 +1247,12 @@ EXPLAIN SELECT t.f1 AS f FROM (SELECT DISTINCT t1.* FROM t1,t2 WHERE t2.f2 = t1.f2) t,t3,t4 WHERE t4.f2 = t3.f2 AND t4.f2 = t.f1 ORDER BY f; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where; Using filesort -1 PRIMARY t4 ref f2 f2 4 t.f1 1 Using index -1 PRIMARY t3 ref f2 f2 4 t.f1 2 Using index -2 DERIVED t2 system NULL NULL NULL NULL 1 Using temporary -2 DERIVED t1 ref f2 f2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 Using where; Using filesort +1 PRIMARY t4 NULL ref f2 f2 4 t.f1 1 Using index +1 PRIMARY t3 NULL ref f2 f2 4 t.f1 2 Using index +2 DERIVED t2 NULL system NULL NULL NULL NULL 1 Using temporary +2 DERIVED t1 NULL ref f2 f2 4 const 2 Using where SELECT t.f1 AS f FROM (SELECT DISTINCT t1.* FROM t1,t2 WHERE t2.f2 = t1.f2) t,t3,t4 WHERE t4.f2 = t3.f2 AND t4.f2 = t.f1 ORDER BY f; @@ -1274,10 +1274,10 @@ a b a b SET SESSION optimizer_switch='derived_with_keys=on'; EXPLAIN SELECT * FROM t1 AS t JOIN v1 AS v WHERE t.a = v.b AND t.b = v.b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t.a 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t.a 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 SELECT * FROM t1 AS t JOIN v1 AS v WHERE t.a = v.b AND t.b = v.b; a b a b 0 0 1 0 @@ -1305,10 +1305,10 @@ EXPLAIN EXTENDED SELECT t3.b, v1.a FROM t3 LEFT JOIN (t2, v1) ON t3.a <> 0 WHERE v1.a = v1.a OR t3.b <> 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 0 0.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 0 0.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t3`.`b` AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t3` left join (`test`.`t2` join `test`.`t1`) on(`test`.`t3`.`a` <> 0) where `test`.`t1`.`a` = `test`.`t1`.`a` or `test`.`t3`.`b` <> 0 DROP VIEW v1; @@ -1333,10 +1333,10 @@ EXPLAIN SELECT * FROM t1 t WHERE EXISTS (SELECT t3.a FROM t3, t2 WHERE t2.a = t3.b AND t.a != 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t3 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM (SELECT * FROM t1) t WHERE EXISTS (SELECT t3.a FROM t3, t2 WHERE t2.a = t3.b AND t.a != 0); @@ -1346,10 +1346,10 @@ EXPLAIN SELECT * FROM (SELECT * FROM t1) t WHERE EXISTS (SELECT t3.a FROM t3, t2 WHERE t2.a = t3.b AND t.a != 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 1 -3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT SUBQUERY t3 NULL system NULL NULL NULL NULL 1 +3 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM v1 t WHERE EXISTS (SELECT t3.a FROM t3, t2 WHERE t2.a = t3.b AND t.a != 0); @@ -1359,10 +1359,10 @@ EXPLAIN SELECT * FROM v1 t WHERE EXISTS (SELECT t3.a FROM t3, t2 WHERE t2.a = t3.b AND t.a != 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t3 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where DROP VIEW v1; DROP TABLE t1,t2,t3; # @@ -1390,10 +1390,10 @@ NULL 174 EXPLAIN SELECT DISTINCT t2.a FROM t1 LEFT JOIN (t3,t2) ON t1.b = 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 SELECT DISTINCT v1.a FROM t1 LEFT JOIN v1 ON t1.b = 0; a NULL @@ -1401,10 +1401,10 @@ NULL 174 EXPLAIN SELECT DISTINCT v1.a FROM t1 LEFT JOIN v1 ON t1.b = 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 DROP VIEW v1; DROP TABLE t1,t2,t3; # @@ -1422,10 +1422,10 @@ NULL 0 0 EXPLAIN EXTENDED SELECT * FROM t2 RIGHT JOIN (SELECT * FROM t1) AS t ON t.a != 0 WHERE t.a IN (SELECT b FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` semi join (dual) where 1 SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0 @@ -1435,10 +1435,10 @@ NULL 0 0 EXPLAIN EXTENDED SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0 WHERE t.a IN (SELECT b FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` semi join (dual) where 1 DROP VIEW v1; @@ -1463,32 +1463,32 @@ b 29 EXPLAIN SELECT DISTINCT t2.b FROM t1,t2,t3 WHERE t3.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t2 ref a a 35 test.t3.a 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 Using temporary +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 NULL ref a a 35 test.t3.a 2 SELECT * FROM (SELECT DISTINCT t2.b FROM t1,t2,t3 WHERE t3.a = t2.a) t; b 28 29 EXPLAIN SELECT * FROM (SELECT DISTINCT t2.b FROM t1,t2,t3 WHERE t3.a = t2.a) t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 -2 DERIVED t1 system NULL NULL NULL NULL 1 Using temporary -2 DERIVED t3 ALL NULL NULL NULL NULL 2 Using where -2 DERIVED t2 ref a a 35 test.t3.a 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 +2 DERIVED t1 NULL system NULL NULL NULL NULL 1 Using temporary +2 DERIVED t3 NULL ALL NULL NULL NULL NULL 2 Using where +2 DERIVED t2 NULL ref a a 35 test.t3.a 2 SELECT * FROM v1; b 28 29 EXPLAIN SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 -2 DERIVED t1 system NULL NULL NULL NULL 1 Using temporary -2 DERIVED t3 ALL NULL NULL NULL NULL 2 Using where -2 DERIVED t2 ref a a 35 test.t3.a 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 +2 DERIVED t1 NULL system NULL NULL NULL NULL 1 Using temporary +2 DERIVED t3 NULL ALL NULL NULL NULL NULL 2 Using where +2 DERIVED t2 NULL ref a a 35 test.t3.a 2 DROP VIEW v1; DROP TABLE t1,t2,t3; # @@ -1508,11 +1508,11 @@ a b EXPLAIN EXTENDED SELECT t.a,t.b FROM t3 RIGHT JOIN (t1 AS t, t2) ON t2.b != 0 WHERE (t.a,t.b) NOT IN (SELECT 7, 5); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select 6 AS `a`,5 AS `b` from `test`.`t3` where 1 SELECT t.a,t.b FROM t3 RIGHT JOIN ((SELECT * FROM t1) AS t, t2) ON t2.b != 0 @@ -1522,11 +1522,11 @@ a b EXPLAIN EXTENDED SELECT t.a,t.b FROM t3 RIGHT JOIN ((SELECT * FROM t1) AS t, t2) ON t2.b != 0 WHERE (t.a,t.b) NOT IN (SELECT 7, 5); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00 -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 100.00 +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select 6 AS `a`,5 AS `b` from `test`.`t3` where 1 SELECT t.a,t.b FROM t3 RIGHT JOIN (v1 AS t, t2) ON t2.b != 0 @@ -1536,11 +1536,11 @@ a b EXPLAIN EXTENDED SELECT t.a,t.b FROM t3 RIGHT JOIN (v1 AS t, t2) ON t2.b != 0 WHERE (t.a,t.b) NOT IN (SELECT 7, 5); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select 6 AS `a`,5 AS `b` from `test`.`t3` where 1 DROP VIEW v1; @@ -1580,10 +1580,10 @@ a 2 EXPLAIN SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY <derived3> ref key0 key0 10 test.t1.a,test.t1.b 2 FirstMatch(t1) -3 DERIVED t2 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived3> NULL ref key0 key0 10 test.t1.a,test.t1.b 2 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 Using temporary; Using filesort SELECT * FROM v2; a b 9 3 @@ -1600,12 +1600,12 @@ a 2 EXPLAIN SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY <derived3> ref key0 key0 10 test.t1.a,test.t1.b 1 FirstMatch(t1) -3 DERIVED t2 ALL NULL NULL NULL NULL 6 -4 UNION t3 ALL NULL NULL NULL NULL 4 -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived3> NULL ref key0 key0 10 test.t1.a,test.t1.b 1 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 +4 UNION t3 NULL ALL NULL NULL NULL NULL 4 +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL DROP VIEW v1,v2; DROP TABLE t1,t2,t3; # @@ -1626,15 +1626,15 @@ SELECT * FROM (SELECT b FROM v2 WHERE b = 0) t WHERE b; b EXPLAIN EXTENDED SELECT * FROM (SELECT b FROM v1 WHERE b = 0) t WHERE b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`b` AS `b` from `test`.`t1` where 0 EXPLAIN EXTENDED SELECT * FROM (SELECT b FROM v2 WHERE b = 0) t WHERE b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `v2`.`b` AS `b` from `test`.`v2` where 0 DROP VIEW v1,v2; @@ -1646,10 +1646,10 @@ DROP TABLE t1; set optimizer_switch='derived_merge=off'; EXPLAIN SELECT * FROM (SELECT * FROM (SELECT @b) AS t) AS s; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 1 -2 DERIVED <derived3> system NULL NULL NULL NULL 1 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 1 +2 DERIVED <derived3> NULL system NULL NULL NULL NULL 1 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used SELECT * FROM (SELECT * FROM (SELECT @b) AS t) AS s; @b NULL @@ -1664,18 +1664,18 @@ INSERT INTO t2 VALUES (9), (NULL), (7); CREATE VIEW v1 AS SELECT * FROM t1,t2; EXPLAIN SELECT * FROM (SELECT * FROM t1,t2) t WHERE b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) SELECT * FROM (SELECT * FROM t1,t2) t WHERE b IS NULL; a b 1 NULL 1 NULL EXPLAIN SELECT * FROM v1 WHERE b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) SELECT * FROM v1 WHERE b IS NULL; a b 1 NULL @@ -1695,10 +1695,10 @@ EXPLAIN EXTENDED SELECT * FROM (SELECT * FROM t1) AS t WHERE EXISTS (SELECT t2.a FROM t3 RIGHT JOIN t2 ON (t3.a = t2.a) WHERE t2.b < t.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -3 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00 -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 100.00 +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 't.a' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(1,<expr_cache><`test`.`t1`.`a`>(exists(/* select#3 */ select 28 from `test`.`t3` where 'j' < `test`.`t1`.`a` limit 1))) @@ -1733,12 +1733,12 @@ LEFT JOIN ON s3.a != 0) ON s2.a != 0) JOIN t5 ON s3.c != 0 AND t5.d = 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE s2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE s3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 0 0.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t5 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE s3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 0 0.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select straight_join `test`.`s2`.`a` AS `a`,`test`.`s3`.`a` AS `a`,`test`.`s3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t5`.`d` AS `d` from `test`.`t2` `s2` join `test`.`t3` `s3` left join (`test`.`t4` left join `test`.`t3` on(`test`.`t4`.`a` <> 0)) on(`test`.`s3`.`a` <> 0) join `test`.`t5` where `test`.`t5`.`d` = 0 and `test`.`s3`.`c` <> 0 and `test`.`s2`.`a` <> 0 SELECT STRAIGHT_JOIN * @@ -1760,12 +1760,12 @@ SELECT STRAIGHT_JOIN * FROM t2 AS s2 , t5, (t3 LEFT JOIN (t4 LEFT JOIN t3 AS s3 ON t4.a != 0) ON t3.a != 0) WHERE s2.a != 0 AND t3.c != 0 AND t5.d = 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE s2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t5 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 0 0.00 Using where -1 SIMPLE s3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 0 0.00 Using where +1 SIMPLE s3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select straight_join `test`.`s2`.`a` AS `a`,`test`.`t5`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`s3`.`a` AS `a`,`test`.`s3`.`c` AS `c` from `test`.`t2` `s2` join `test`.`t5` join `test`.`t3` left join (`test`.`t4` left join `test`.`t3` `s3` on(`test`.`t4`.`a` <> 0)) on(`test`.`t3`.`a` <> 0) where `test`.`t5`.`d` = 0 and `test`.`s2`.`a` <> 0 and `test`.`t3`.`c` <> 0 SELECT STRAIGHT_JOIN * @@ -1782,12 +1782,12 @@ SELECT STRAIGHT_JOIN * FROM v2 AS s2 , t5, (t3 LEFT JOIN (t4 LEFT JOIN v3 AS s3 ON t4.a != 0) ON t3.a != 0) WHERE s2.a != 0 AND t3.c != 0 AND t5.d = 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t5 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 0 0.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 0 0.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select straight_join `test`.`t2`.`a` AS `a`,`test`.`t5`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c` from `test`.`t2` join `test`.`t5` join `test`.`t3` left join (`test`.`t4` left join (`test`.`t3`) on(`test`.`t4`.`a` <> 0)) on(`test`.`t3`.`a` <> 0) where `test`.`t5`.`d` = 0 and `test`.`t2`.`a` <> 0 and `test`.`t3`.`c` <> 0 SELECT STRAIGHT_JOIN * @@ -1878,17 +1878,17 @@ SET SESSION optimizer_switch='derived_merge=on,subquery_cache=off,materializatio EXPLAIN SELECT * FROM t1 , t2 WHERE (t2.a ,t1.b) NOT IN (SELECT DISTINCT c,a FROM t3 t); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t unique_subquery PRIMARY,c PRIMARY 4 func 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t NULL unique_subquery PRIMARY,c PRIMARY 4 func 1 Using where EXPLAIN SELECT * FROM t1 , t2 WHERE (t2.a ,t1.b) NOT IN (SELECT DISTINCT c,a FROM (SELECT * FROM t3) t); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,c PRIMARY 4 func 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t3 NULL unique_subquery PRIMARY,c PRIMARY 4 func 1 Using where SELECT * FROM t1 , t2 WHERE (t2.a ,t1.b) NOT IN (SELECT DISTINCT c,a FROM (SELECT * FROM t3) t); b a @@ -1914,11 +1914,11 @@ EXPLAIN SELECT * FROM t3 WHERE t3.b IN (SELECT v1.b FROM v1, t2 WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 3 Using where; Start temporary; End temporary -3 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 3 Using where; Start temporary; End temporary +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * FROM t3 WHERE t3.b IN (SELECT v1.b FROM v1, t2 WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c); @@ -1929,11 +1929,11 @@ EXPLAIN SELECT * FROM t3 WHERE t3.b IN (SELECT v1.b FROM v1, t2 WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY <derived3> ref key1 key1 8 const,const 0 Start temporary -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (flat, BNL join) -3 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY <derived3> NULL ref key1 key1 8 const,const 0 Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * FROM t3 WHERE t3.b IN (SELECT v1.b FROM v1, t2 WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c); @@ -1953,10 +1953,10 @@ CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; SET SESSION optimizer_switch='derived_with_keys=on'; EXPLAIN SELECT * FROM t1 WHERE t1.b IN (SELECT v2.a FROM v2 WHERE v2.b = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY <derived3> ref key0 key0 10 test.t1.b,test.t1.a 2 FirstMatch(t1) -3 DERIVED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived3> NULL ref key0 key0 10 test.t1.b,test.t1.a 2 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE t1.b IN (SELECT v2.a FROM v2 WHERE v2.b = t1.a); a b 5 4 @@ -1977,9 +1977,9 @@ a EXPLAIN SELECT t1.a FROM t1 WHERE EXISTS (SELECT t2.a FROM t2 WHERE t2.b < t1.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT v1.a FROM v1 WHERE EXISTS (SELECT t2.a FROM t2 WHERE t2.b < v1.b); a @@ -1987,9 +1987,9 @@ a EXPLAIN SELECT v1.a FROM v1 WHERE EXISTS (SELECT t2.a FROM t2 WHERE t2.b < v1.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where DROP VIEW v1; DROP TABLE t1,t2; # @@ -2007,11 +2007,11 @@ a 7 EXPLAIN SELECT v1.a FROM v1,v2 WHERE v2.b = v1.b ORDER BY 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using where; Using filesort -1 PRIMARY <derived3> ref key0 key0 4 v1.b 2 -3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort -2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 Using where; Using filesort +1 PRIMARY <derived3> NULL ref key0 key0 4 v1.b 2 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 Using temporary; Using filesort DROP VIEW v1,v2; DROP TABLE t1,t2; # @@ -2040,12 +2040,12 @@ SET SESSION join_cache_level = 1; SET SESSION join_buffer_size = 512; EXPLAIN SELECT t2.d FROM t1,t2,v3 WHERE v3.e = t2.d AND v3.i < 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t5 ALL NULL NULL NULL NULL 2 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 SIMPLE t3 ref e e 3 test.t2.d 1 Using index -1 SIMPLE t4 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ref e e 3 test.t2.d 1 Using index +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) SELECT t2.d FROM t1,t2,v3 WHERE v3.e = t2.d AND v3.i < 3; d w @@ -2090,10 +2090,10 @@ EXPLAIN EXTENDED SELECT t.b, t.c, t1.a FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t WHERE t.b AND t.c = t1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`b` <> 0 SELECT t.b, t.c, t1.a @@ -2105,10 +2105,10 @@ EXPLAIN EXTENDED SELECT t.b, t.c, t1.a FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t WHERE t.b <> 0 AND t.c = t1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`b` <> 0 SELECT t.b, t.c, t1.a @@ -2121,10 +2121,10 @@ EXPLAIN EXTENDED SELECT t.b, t.c, t1.a FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t WHERE t.b AND t.c = t1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t2`.`a`) where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`b` <> 0 SELECT t.b, t.c, t1.a @@ -2136,10 +2136,10 @@ EXPLAIN EXTENDED SELECT t.b, t.c, t1.a FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t WHERE t.b <> 0 AND t.c = t1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t2`.`a`) where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`b` <> 0 SELECT t.b, t.c, t1.a @@ -2163,10 +2163,10 @@ SET SESSION optimizer_switch = 'derived_with_keys=on'; SET SESSION join_cache_level = 4; EXPLAIN SELECT t1.b,v2.a FROM t1 LEFT JOIN v2 ON v2.a = t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 1 Using where -2 DERIVED t2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 1 Using where +2 DERIVED t2 NULL system NULL NULL NULL NULL 1 SELECT t1.b,v2.a FROM t1 LEFT JOIN v2 ON v2.a = t1.a; b a NULL NULL @@ -2177,11 +2177,11 @@ INSERT INTO t3 VALUES (8,'x'), (5,'r'), (9,'y'); EXPLAIN SELECT * FROM t3 WHERE t3.b <> ANY (SELECT t1.b FROM t1 LEFT JOIN v2 ON v2.a = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where -2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 1 Using where -3 DERIVED t2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 Using where +2 DEPENDENT SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 1 Using where +3 DERIVED t2 NULL system NULL NULL NULL NULL 1 SELECT * FROM t3 WHERE t3.b <> ANY (SELECT t1.b FROM t1 LEFT JOIN v2 ON v2.a = t1.a); a b @@ -2205,10 +2205,10 @@ CREATE VIEW v3 AS SELECT * FROM t3; SET SESSION optimizer_switch='semijoin=on'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT v3.b FROM t2 RIGHT JOIN v3 ON v3.a = t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 system NULL NULL NULL NULL 1 -1 PRIMARY t2 const PRIMARY PRIMARY 4 const 1 Using index -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE a IN (SELECT v3.b FROM t2 RIGHT JOIN v3 ON v3.a = t2.a); a x @@ -2260,10 +2260,10 @@ SET @save_optimizer_switch=@@optimizer_switch; SET optimizer_switch = 'derived_with_keys=on'; SET @@tmp_table_size=1024*4; explain SELECT * FROM (SELECT t1.* FROM t1, t2) AS t JOIN t3 ON t3.a = t.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 1 -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 -1 SIMPLE t1 ALL NULL NULL NULL NULL 21 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 21 Using where; Using join buffer (flat, BNL join) SELECT * FROM (SELECT t1.* FROM t1, t2) AS t JOIN t3 ON t3.a = t.b; a b a USA Miami Miami @@ -2328,9 +2328,9 @@ a 4 EXPLAIN SELECT * FROM (SELECT * FROM t1 LIMIT 3) t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 -2 DERIVED t1 ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 DROP TABLE t1; # # LP BUG#921878 incorrect check of items during columns union types @@ -2368,10 +2368,10 @@ GROUP_CONCAT(COLUMN_NAME ORDER BY SEQ_IN_INDEX ASC) AS COL_NAMES FROM INFORMATION_SCHEMA.STATISTICS GROUP BY TABLE_SCHEMA) AS UNIQUES ON ( COLUMNS.TABLE_SCHEMA = UNIQUES.TABLE_SCHEMA); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY COLUMNS ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -2 DERIVED STATISTICS ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY COLUMNS NULL ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 DERIVED STATISTICS NULL ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases; Using filesort SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.COLUMNS INNER JOIN @@ -2406,10 +2406,10 @@ SET SESSION optimizer_switch='derived_merge=off'; SET SESSION optimizer_switch='derived_with_keys=off'; EXPLAIN SELECT * FROM t1, v WHERE a = b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using where -2 DERIVED t2 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 Using where +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 Using filesort SELECT * FROM t1, v WHERE a = b; a b gc 132 132 test1,text3 @@ -2417,10 +2417,10 @@ SET SESSION optimizer_switch='derived_merge=on'; SET SESSION optimizer_switch='derived_with_keys=on'; EXPLAIN SELECT * FROM t1, v WHERE a = b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY <derived2> ref key0 key0 5 const 0 -2 DERIVED t2 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY <derived2> NULL ref key0 key0 5 const 0 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 Using filesort SELECT * FROM t1, v WHERE a = b; a b gc 132 132 test1,text3 @@ -2594,10 +2594,10 @@ INSERT INTO t2 VALUES ('b',2), ('c',3); CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; EXPLAIN EXTENDED SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.c2 2 100.00 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c2 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1003 /* select#1 */ select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where `v1`.`c1` = `test`.`t2`.`c1` and `v1`.`c2` = `test`.`t2`.`c2` SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2; @@ -2607,10 +2607,10 @@ c 3 EXPLAIN EXTENDED SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2 WHERE t.g=t2.c1 AND t.m=t2.c2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t2.c2 2 100.00 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c2 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from (/* select#2 */ select `test`.`t1`.`c1` AS `g`,max(`test`.`t1`.`c2`) AS `m` from `test`.`t1` group by `test`.`t1`.`c1`) `t` join `test`.`t2` where `t`.`g` = `test`.`t2`.`c1` and `t`.`m` = `test`.`t2`.`c2` SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2 @@ -2619,10 +2619,10 @@ c1 c2 c 3 EXPLAIN EXTENDED SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1003 /* select#1 */ select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2`,`test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where `v1`.`c1` = `test`.`t2`.`c1` SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1; @@ -2668,8 +2668,8 @@ CREATE TABLE t1 (a int, b int) ENGINE=MyISAM; INSERT INTO t1 VALUES (4,1); CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; EXPLAIN EXTENDED SELECT a FROM v1 WHERE a > 100 ORDER BY b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 4 AS `a` from dual where 0 order by 1 DROP VIEW v1; @@ -2771,11 +2771,11 @@ LEFT JOIN pictures p ON p.id = g.p_random ORDER BY gallery_name ASC ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 10 Using temporary; Using filesort -1 PRIMARY p eq_ref PRIMARY PRIMARY 4 g.p_random 1 Using where -2 DERIVED gal ALL NULL NULL NULL NULL 10 -3 DEPENDENT SUBQUERY pi ref gallery_id gallery_id 4 test.gal.id 4 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +1 PRIMARY p NULL eq_ref PRIMARY PRIMARY 4 g.p_random 1 Using where +2 DERIVED gal NULL ALL NULL NULL NULL NULL 10 +3 DEPENDENT SUBQUERY pi NULL ref gallery_id gallery_id 4 test.gal.id 4 Using temporary; Using filesort drop table galleries, pictures; # # MDEV-5740: Assertion @@ -2843,11 +2843,11 @@ SELECT * FROM t2 x, (SELECT t2.useraccessfamily, t2.serialized AS picturesubuser, COUNT(*) FROM t2, t1 GROUP BY t2.useraccessfamily, picturesubuser) y WHERE x.useraccessfamily = y.useraccessfamily; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY x system NULL NULL NULL NULL 1 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where -2 DERIVED t2 system NULL NULL NULL NULL 1 -2 DERIVED t1 index NULL index_td_familyid_id 772 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY x NULL system NULL NULL NULL NULL 1 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 Using where +2 DERIVED t2 NULL system NULL NULL NULL NULL 1 +2 DERIVED t1 NULL index NULL index_td_familyid_id 772 NULL 2 Using index SELECT * FROM t2 x, (SELECT t2.useraccessfamily, t2.serialized AS picturesubuser, COUNT(*) FROM t2, t1 GROUP BY t2.useraccessfamily, picturesubuser) y @@ -2898,10 +2898,10 @@ FROM t2 RIGHT JOIN ( SELECT * FROM t1 ) AS dt ON t2.col_varchar = dt.col_varchar WHERE t2.col_int IS NOT NULL ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 11 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 11 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 SET @@max_heap_table_size= @save_heap_size; SET optimizer_switch=@save_optimizer_switch; DROP TABLE t1,t2; @@ -2938,11 +2938,11 @@ INNER JOIN FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY m2 ALL NULL NULL NULL NULL 9 -1 PRIMARY <derived2> ref key0 key0 7 test.m2.matintnum 2 -2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort -2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY m2 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> NULL ref key0 key0 7 test.m2.matintnum 2 +2 DERIVED mp NULL ALL NULL NULL NULL NULL 9 Using temporary; Using filesort +2 DERIVED m1 NULL eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 prepare stmt1 from "SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id FROM t1 m2 @@ -3019,18 +3019,18 @@ test.t1 analyze status OK test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain select a from t1 where a in (select b from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 139 Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 7 Using where +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 139 Using index; FirstMatch(t1) explain select * from (select a from t1 where a in (select b from t2)) t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 139 Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 7 Using where +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 139 Using index; FirstMatch(t1) create view v1 as select a from t1 where a in (select b from t2); explain select * from v1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 139 Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 7 Using where +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 139 Using index; FirstMatch(t1) drop view v1; drop table t1,t2; # @@ -3048,9 +3048,9 @@ foo foo EXPLAIN EXTENDED SELECT STRAIGHT_JOIN * FROM ( SELECT * FROM t1 WHERE c1 IN ( SELECT c2 FROM t2 ) ) AS sq; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select straight_join `test`.`t1`.`c1` AS `c1` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`c1`,<exists>(/* select#3 */ select `test`.`t2`.`c2` from `test`.`t2` where <cache>(`test`.`t1`.`c1`) = `test`.`t2`.`c2`)) DROP TABLE t1, t2; @@ -3072,10 +3072,10 @@ id order_pk 7 7 EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN v2 ON t1.id=v2.order_pk; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY <derived2> ref key0 key0 5 test.t1.id 2 100.00 -2 DERIVED t1 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.id 2 100.00 +2 DERIVED t1 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index; Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`v2`.`order_pk` AS `order_pk` from `test`.`t1` left join `test`.`v2` on(`v2`.`order_pk` = `test`.`t1`.`id`) where 1 SELECT * FROM t1 LEFT JOIN v3 ON t1.id=v3.order_pk; @@ -3086,10 +3086,10 @@ id order_pk 7 7 EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN v3 ON t1.id=v3.order_pk; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY <derived2> ref key0 key0 5 test.t1.id 2 100.00 -2 DERIVED t1 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.id 2 100.00 +2 DERIVED t1 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index; Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`v3`.`order_pk` AS `order_pk` from `test`.`t1` left join `test`.`v3` on(`v3`.`order_pk` = `test`.`t1`.`id`) where 1 DROP VIEW v1,v2,v3; @@ -3348,154 +3348,154 @@ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id ) gp_20 ON gp_20.id=t2.id ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY p4 ALL NULL NULL NULL NULL 550 Using where -1 PRIMARY p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) -1 PRIMARY p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p4 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p1 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p3 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p4 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p1 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p3 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p4 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p1 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p3 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p4 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived17> ALL NULL NULL NULL NULL 50328437500000 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived14> ALL NULL NULL NULL NULL 27680640625000000 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived9> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived10> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived11> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived12> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived13> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived15> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived16> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived7> ALL NULL NULL NULL NULL 18446744073709551615 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived8> ALL NULL NULL NULL NULL 18446744073709551615 Using where; Using join buffer (incremental, BNL join) -17 DERIVED t2 system NULL NULL NULL NULL 1 -17 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where -17 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) -17 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -17 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -17 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -16 DERIVED t2 system NULL NULL NULL NULL 1 -16 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where -16 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) -16 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -16 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -16 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -16 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -16 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -15 DERIVED t2 system NULL NULL NULL NULL 1 -15 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where -15 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) -15 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -15 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -15 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -15 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -15 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -14 DERIVED t2 system NULL NULL NULL NULL 1 -14 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where -14 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) -14 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -14 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -14 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -14 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -13 DERIVED t2 system NULL NULL NULL NULL 1 -13 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where -13 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) -13 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -13 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -13 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -13 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -13 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -12 DERIVED t2 system NULL NULL NULL NULL 1 -12 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where -12 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) -12 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -12 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -12 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -12 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -12 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -11 DERIVED t2 system NULL NULL NULL NULL 1 -11 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where -11 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) -11 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -11 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -11 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -11 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -11 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -10 DERIVED t2 system NULL NULL NULL NULL 1 -10 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where -10 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) -10 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -10 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -10 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -10 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -10 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -9 DERIVED t2 system NULL NULL NULL NULL 1 -9 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where -9 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) -9 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -9 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -9 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -9 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -9 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -8 DERIVED t2 system NULL NULL NULL NULL 1 -8 DERIVED p1 ALL NULL NULL NULL NULL 550 Using where -8 DERIVED p3 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) -8 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -7 DERIVED t2 system NULL NULL NULL NULL 1 -7 DERIVED p1 ALL NULL NULL NULL NULL 550 Using where -7 DERIVED p3 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) -7 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY p4 NULL ALL NULL NULL NULL NULL 550 Using where +1 PRIMARY p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) +1 PRIMARY p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p4 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p1 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p3 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p4 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p1 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p3 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p4 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p1 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p3 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p4 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived17> NULL ALL NULL NULL NULL NULL 50328437500000 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived14> NULL ALL NULL NULL NULL NULL 27680640625000000 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived9> NULL ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived10> NULL ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived11> NULL ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived12> NULL ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived13> NULL ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived15> NULL ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived16> NULL ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived7> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived8> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using where; Using join buffer (incremental, BNL join) +17 DERIVED t2 NULL system NULL NULL NULL NULL 1 +17 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 Using where +17 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) +17 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +16 DERIVED t2 NULL system NULL NULL NULL NULL 1 +16 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 Using where +16 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) +16 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +15 DERIVED t2 NULL system NULL NULL NULL NULL 1 +15 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 Using where +15 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) +15 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +14 DERIVED t2 NULL system NULL NULL NULL NULL 1 +14 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 Using where +14 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) +14 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +13 DERIVED t2 NULL system NULL NULL NULL NULL 1 +13 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 Using where +13 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) +13 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +12 DERIVED t2 NULL system NULL NULL NULL NULL 1 +12 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 Using where +12 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) +12 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +11 DERIVED t2 NULL system NULL NULL NULL NULL 1 +11 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 Using where +11 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) +11 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +10 DERIVED t2 NULL system NULL NULL NULL NULL 1 +10 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 Using where +10 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) +10 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +9 DERIVED t2 NULL system NULL NULL NULL NULL 1 +9 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 Using where +9 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) +9 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +8 DERIVED t2 NULL system NULL NULL NULL NULL 1 +8 DERIVED p1 NULL ALL NULL NULL NULL NULL 550 Using where +8 DERIVED p3 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) +8 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +7 DERIVED t2 NULL system NULL NULL NULL NULL 1 +7 DERIVED p1 NULL ALL NULL NULL NULL NULL 550 Using where +7 DERIVED p3 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join) +7 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join) DROP TABLE t1, t2; # # MDEV-19778: equality condition for mergeable view returning constants @@ -3516,9 +3516,9 @@ pk a d b 2 3 3 NULL 2 3 3 3 explain extended select * from t1 left join v1 on t1.pk <= 2 where t1.a=v1.d; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,3 AS `d`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = 3 and `test`.`t1`.`pk` <= 2 select * from t1 left join (select 3 as d, t2.b from t2) dt on t1.pk <= 2 @@ -3530,9 +3530,9 @@ pk a d b 2 3 3 3 explain extended select * from t1 left join (select 3 as d, t2.b from t2) dt on t1.pk <= 2 where t1.a=dt.d; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,3 AS `d`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = 3 and `test`.`t1`.`pk` <= 2 select * from t1 left join (v1,t3) on t1.pk <= 2 where t1.a=v1.d; @@ -3546,10 +3546,10 @@ pk a d b c 2 3 3 3 1 2 3 3 3 8 explain extended select * from t1 left join (v1,t3) on t1.pk <= 2 where t1.a=v1.d; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,3 AS `d`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`c` AS `c` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t1`.`a` = 3 and `test`.`t1`.`pk` <= 2 drop view v1; diff --git a/mysql-test/main/desc_index_range.result b/mysql-test/main/desc_index_range.result index 94176270dbf..9d45513b37a 100644 --- a/mysql-test/main/desc_index_range.result +++ b/mysql-test/main/desc_index_range.result @@ -5,8 +5,8 @@ key (a desc) insert into t1 select seq from seq_1_to_1000; set optimizer_trace=1; explain select * from t1 force index(a) where a in (2, 4, 6); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 3 Using where; Using index select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) @@ -37,8 +37,8 @@ key ab(a, b desc) insert into t1 select A.seq, B.seq*10 from seq_1_to_10 A, seq_1_to_10 B; set optimizer_trace=1; explain select * from t1 force index(ab) where a>=8 and b>=50; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range ab ab 4 NULL 51 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range ab ab 4 NULL 51 Using where; Using index select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) @@ -49,8 +49,8 @@ json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) ] ] explain select * from t1 force index(ab) where a>=8 and b<=50; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range ab ab 8 NULL 46 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range ab ab 8 NULL 46 Using where; Using index select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) @@ -96,8 +96,8 @@ a b 10 10 explain select * from t1 where a between 2 and 4 and b between 50 and 80; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range ab ab 8 NULL 17 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range ab ab 8 NULL 17 Using where; Using index select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) @@ -130,8 +130,8 @@ key ab(a desc, b desc) insert into t2 select A.seq, B.seq*10 from seq_1_to_10 A, seq_1_to_10 B; explain select * from t2 where a between 2 and 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range ab ab 4 NULL 40 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range ab ab 4 NULL 40 Using where; Using index select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) @@ -143,8 +143,8 @@ json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) ] explain select * from t2 where a between 2 and 4 and b between 50 and 80; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range ab ab 8 NULL 31 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range ab ab 8 NULL 31 Using where; Using index select json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.range_access_plan.ranges')) @@ -161,8 +161,8 @@ drop table t2; CREATE TABLE t1 (p int NOT NULL, a int NOT NULL, PRIMARY KEY (p,a desc)); insert into t1 select 2,seq from seq_0_to_1000; EXPLAIN select MIN(a) from t1 where p = 2 group by p; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref PRIMARY PRIMARY 4 const 1000 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 4 const 1000 Using index select json_detailed(json_extract(trace, '$**.potential_group_range_indexes')) from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.potential_group_range_indexes')) @@ -206,8 +206,8 @@ insert into t1 values (10000, NULL, 255); insert into t1 select seq+20000, seq+20000, seq+20000 from seq_1_to_1500; # Must use ROR-intersect: explain select * from t1 where b = 255 AND a IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b b,a 5,5 NULL 1 Using intersect(b,a); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b b,a 5,5 NULL 1 Using intersect(b,a); Using where; Using index select * from t1 where b = 255 AND a IS NULL; pk a b 10000 NULL 255 diff --git a/mysql-test/main/distinct.result b/mysql-test/main/distinct.result index 0e31a174be7..6bb31d13b4d 100644 --- a/mysql-test/main/distinct.result +++ b/mysql-test/main/distinct.result @@ -172,10 +172,10 @@ b INSERT INTO t2 values (1),(2),(3); INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2'); explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index a a 4 NULL 5 Using index; Using temporary -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 Using where -1 SIMPLE t3 ref a a 5 test.t1.b 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index a a 4 NULL 5 Using index; Using temporary +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 Using where +1 SIMPLE t3 NULL ref a a 5 test.t1.b 2 Using index SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a; a 1 @@ -188,9 +188,9 @@ insert into t3 select * from t4; insert into t4 select * from t3; insert into t3 select * from t4; explain select distinct t1.a from t1,t3 where t1.a=t3.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary -1 SIMPLE t3 ref a a 5 test.t1.a 11 Using index; Distinct +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary +1 SIMPLE t3 NULL ref a a 5 test.t1.a 11 Using index; Distinct select distinct t1.a from t1,t3 where t1.a=t3.a; a 1 @@ -199,29 +199,29 @@ select distinct 1 from t1,t3 where t1.a=t3.a; 1 1 explain SELECT distinct t1.a from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 Using index explain SELECT distinct t1.a from t1 order by a desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 Using index explain SELECT t1.a from t1 group by a order by a desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 Using index explain SELECT distinct t1.a from t1 order by a desc limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 1 Using index explain SELECT distinct a from t3 order by a desc limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index NULL a 5 NULL 40 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL index NULL a 5 NULL 40 Using index explain SELECT distinct a,b from t3 order by a+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 204 Using temporary; Using filesort explain SELECT distinct a,b from t3 order by a limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index NULL a 5 NULL 2 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL index NULL a 5 NULL 2 Using temporary explain SELECT a,b from t3 group by a,b order by a+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 204 Using temporary; Using filesort drop table t1,t2,t3,t4; CREATE TABLE t1 (name varchar(255)); INSERT INTO t1 VALUES ('aa'),('ab'),('ac'),('ad'),('ae'); @@ -300,14 +300,14 @@ on j_lj_t3.id=t3_lj.id WHERE ((t1.id=j_lj_t2.id AND t2_lj.id IS NULL) OR (t1.id=t2.id AND t2.idx=2)) AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index id id 4 NULL 2 Using index; Using temporary -1 SIMPLE t2 index id id 8 NULL 1 Using index; Using join buffer (flat, BNL join) -1 SIMPLE t3 index id id 8 NULL 1 Using index; Using join buffer (flat, BNL join) -1 SIMPLE j_lj_t2 index id id 4 NULL 2 Using where; Using index; Using join buffer (flat, BNL join) -1 SIMPLE t2_lj ref id id 4 test.j_lj_t2.id 1 Using where; Using index -1 SIMPLE j_lj_t3 index id id 4 NULL 2 Using where; Using index; Using join buffer (flat, BNL join) -1 SIMPLE t3_lj ref id id 4 test.j_lj_t3.id 1 Using where; Using index; Distinct +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index id id 4 NULL 2 Using index; Using temporary +1 SIMPLE t2 NULL index id id 8 NULL 1 Using index; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL index id id 8 NULL 1 Using index; Using join buffer (flat, BNL join) +1 SIMPLE j_lj_t2 NULL index id id 4 NULL 2 Using where; Using index; Using join buffer (flat, BNL join) +1 SIMPLE t2_lj NULL ref id id 4 test.j_lj_t2.id 1 Using where; Using index +1 SIMPLE j_lj_t3 NULL index id id 4 NULL 2 Using where; Using index; Using join buffer (flat, BNL join) +1 SIMPLE t3_lj NULL ref id id 4 test.j_lj_t3.id 1 Using where; Using index; Distinct SELECT DISTINCT t1.id from @@ -510,54 +510,54 @@ DROP TABLE t1,t2; CREATE TABLE t1(a INT PRIMARY KEY, b INT); INSERT INTO t1 VALUES (1,1), (2,1), (3,1); EXPLAIN SELECT DISTINCT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 3 Using index EXPLAIN SELECT DISTINCT a,b FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1_1 ALL NULL NULL NULL NULL 3 Using temporary -1 SIMPLE t1_2 index NULL PRIMARY 4 NULL 3 Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1_1 NULL ALL NULL NULL NULL NULL 3 Using temporary +1 SIMPLE t1_2 NULL index NULL PRIMARY 4 NULL 3 Using index; Using join buffer (flat, BNL join) EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2 WHERE t1_1.a = t1_2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1_1 ALL PRIMARY NULL NULL NULL 3 Using temporary -1 SIMPLE t1_2 eq_ref PRIMARY PRIMARY 4 test.t1_1.a 1 Using index; Distinct +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1_1 NULL ALL PRIMARY NULL NULL NULL 3 Using temporary +1 SIMPLE t1_2 NULL eq_ref PRIMARY PRIMARY 4 test.t1_1.a 1 Using index; Distinct EXPLAIN SELECT a FROM t1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 3 Using index EXPLAIN SELECT a,b FROM t1 GROUP BY a,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using filesort EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using filesort CREATE TABLE t2(a INT, b INT NOT NULL, c INT NOT NULL, d INT, PRIMARY KEY (a,b)); INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4); EXPLAIN SELECT DISTINCT a FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL PRIMARY 4 NULL 4 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL PRIMARY 4 NULL 4 Using index for group-by EXPLAIN SELECT DISTINCT a,a FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL PRIMARY 4 NULL 4 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL PRIMARY 4 NULL 4 Using index for group-by EXPLAIN SELECT DISTINCT b,a FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL PRIMARY 8 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL PRIMARY 8 NULL 3 Using index EXPLAIN SELECT DISTINCT a,c FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using temporary EXPLAIN SELECT DISTINCT c,a,b FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using temporary; Using filesort CREATE UNIQUE INDEX c_b_unq ON t2 (c,b); EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using filesort DROP TABLE t1,t2; create table t1 (id int, dsc varchar(50)); insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three"); @@ -570,8 +570,8 @@ drop table t1; CREATE TABLE t1 (a int primary key, b int); INSERT INTO t1 (a,b) values (1,1), (2,3), (3,2); explain SELECT DISTINCT a, b FROM t1 ORDER BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using filesort SELECT DISTINCT a, b FROM t1 ORDER BY b; a b 1 1 @@ -606,8 +606,8 @@ INSERT INTO t1 SELECT a + 2, a + 102 FROM t1; INSERT INTO t1 SELECT a + 4, a + 104 FROM t1; INSERT INTO t1 SELECT a + 8, a + 108 FROM t1; EXPLAIN SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 8 NULL 16 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 16 Using where; Using index SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a; a a DROP TABLE t1; @@ -688,14 +688,14 @@ DROP TABLE t1; CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('1972-07-29'), ('1972-02-06'); EXPLAIN SELECT (SELECT DISTINCT a FROM t1 WHERE a = '2002-08-03'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where EXPLAIN SELECT (SELECT DISTINCT ADDDATE(a,1) FROM t1 WHERE ADDDATE(a,1) = '2002-08-03'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where CREATE TABLE t2 (a CHAR(5) CHARACTER SET latin1 COLLATE latin1_general_ci); INSERT INTO t2 VALUES (0xf6); INSERT INTO t2 VALUES ('oe'); @@ -710,8 +710,8 @@ DROP TABLE t1, t2; CREATE TABLE t1 (a INT, UNIQUE (a)); INSERT INTO t1 VALUES (4),(null),(2),(1),(null),(3); EXPLAIN SELECT DISTINCT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 6 Using index SELECT DISTINCT a FROM t1; a NULL @@ -720,8 +720,8 @@ NULL 3 4 EXPLAIN SELECT a FROM t1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 6 Using index SELECT a FROM t1 GROUP BY a; a NULL @@ -755,8 +755,8 @@ INSERT INTO t1(a, b, c) VALUES (1, 1, 1), (1, 2, 2), (1, 2, 3); EXPLAIN SELECT DISTINCT a, b, d, c FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL PRIMARY 16 NULL 7 Using index for group-by; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL PRIMARY 16 NULL 7 Using index for group-by; Using temporary SELECT DISTINCT a, b, d, c FROM t1; a b d c 1 1 0 1 @@ -808,31 +808,31 @@ a 2010-10-10 20101010 explain select distinct a from t1 where a = DATE('2010-10-10'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where; Using temporary drop table t1; # date = string create table t1 (a date); insert t1 values ('2010-10-10'), ('20101010'); explain select distinct a from t1 where a = '2010-10-10'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where drop table t1; # double = string create table t1 (a double); insert t1 values (2), (2); explain select distinct a from t1 where a = '2'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where # double = int explain select distinct a from t1 where a = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where # string = double alter table t1 modify a varchar(100); explain select distinct a from t1 where a = 2e0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where; Using temporary drop table t1; create table t1 (f1 varchar(40)); insert into t1 values ('2010-10-10 00:00:00.0001'),('2010-10-10 00:00:00.0002'),('2010-10-10 00:00:00.0003'); @@ -914,11 +914,11 @@ COUNT(DISTINCT t1.id) EXPLAIN EXTENDED SELECT STRAIGHT_JOIN DISTINCT t1.id FROM t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 96 100.00 Using where; Using temporary -1 PRIMARY <derived2> ref key0 key0 5 test.t1.i1 9 100.00 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 96 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 96 100.00 Using where; Using temporary +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.i1 9 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 96 100.00 Using where Warnings: Note 1003 /* select#1 */ select straight_join distinct `test`.`t1`.`id` AS `id` from `test`.`t1` join `test`.`v1` join `test`.`t2` where `test`.`t2`.`i` = `v1`.`id` and `v1`.`i1` = `test`.`t1`.`i1` and `v1`.`id` <> 3 set join_buffer_size=1024; @@ -1059,10 +1059,10 @@ explain ( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) ) UNION ( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 2 Using index; Using temporary -2 UNCACHEABLE UNION t1 index NULL PRIMARY 4 NULL 2 Using index; Using temporary -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 2 Using index; Using temporary +2 UNCACHEABLE UNION t1 NULL index NULL PRIMARY 4 NULL 2 Using index; Using temporary +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL ( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) ) UNION ( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) ); @@ -1100,9 +1100,9 @@ id # Test the second part of the fix: just check that "LIMIT 0 OFFSET n" is # handled in the same way as "LIMIT 0" explain select * from t1 limit 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Zero limit explain select * from t1 limit 0 offset 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Zero limit drop table t1, t2; diff --git a/mysql-test/main/dyncol.result b/mysql-test/main/dyncol.result index 7bc011ece87..5438aa2f8c8 100644 --- a/mysql-test/main/dyncol.result +++ b/mysql-test/main/dyncol.result @@ -154,8 +154,8 @@ select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8, 6, "2011-04-05" AS date, 7, "- 0:45:49.000001" AS time, 8, "2011-04-05 0:45:49.000001" AS datetime)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select hex(column_create(1,'afaf' AS char charset utf8mb3 ,2,1212 AS unsigned int,3,1212 AS int,4,12.12 AS double,4 + 1,12.12 AS decimal,6,'2011-04-05' AS date,7,'- 0:45:49.000001' AS time,8,'2011-04-05 0:45:49.000001' AS datetime)) AS `hex(COLUMN_CREATE(1, "afaf" AS char character set utf8, 2, 1212 AS unsigned int, @@ -179,14 +179,14 @@ column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int) 1212 explain extended select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select column_get(column_create(1,1212 AS unsigned int),1 as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int)` explain extended select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select column_get(column_create(1,1212 AS unsigned int),1 as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned)` select column_get(column_create(1, 1212 AS decimal), 1 as unsigned int); @@ -258,14 +258,14 @@ column_get(column_create(1, 1212 AS int), 1 as int) 1212 explain extended select column_get(column_create(1, 1212 AS int), 1 as int); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select column_get(column_create(1,1212 AS int),1 as signed) AS `column_get(column_create(1, 1212 AS int), 1 as int)` explain extended select column_get(column_create(1, 1212 AS int), 1 as signed int); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select column_get(column_create(1,1212 AS int),1 as signed) AS `column_get(column_create(1, 1212 AS int), 1 as signed int)` select column_get(column_create(1, -1212 AS int), 1 as int); @@ -365,8 +365,8 @@ column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8 1212 explain extended select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select column_get(column_create(1,'1212' AS char charset utf8mb3 ),1 as char charset utf8mb3) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8)` select column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8); @@ -425,8 +425,8 @@ column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset bina 1212 explain extended select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select column_get(column_create(1,'1212' AS char charset utf8mb3 ),1 as char charset binary) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary)` # @@ -437,14 +437,14 @@ column_get(column_create(1, 1212.12 AS double), 1 as double) 1212.12 explain extended select column_get(column_create(1, 1212.12 AS double), 1 as double); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select column_get(column_create(1,1212.12 AS double),1 as double) AS `column_get(column_create(1, 1212.12 AS double), 1 as double)` explain extended select column_get(column_create(1, 1212.12 AS double), 1 as double(6,2)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select column_get(column_create(1,1212.12 AS double),1 as double(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as double(6,2))` select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as double); @@ -518,14 +518,14 @@ column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2)) 1212.12 explain extended select column_get(column_create(1, 1212.12 AS double), 1 as decimal); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select column_get(column_create(1,1212.12 AS double),1 as decimal(10,0)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal)` explain extended select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select column_get(column_create(1,1212.12 AS double),1 as decimal(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2))` select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal(20,0)); diff --git a/mysql-test/main/empty_string_literal.result b/mysql-test/main/empty_string_literal.result index bf9f30665f2..b7b4dee1c9b 100644 --- a/mysql-test/main/empty_string_literal.result +++ b/mysql-test/main/empty_string_literal.result @@ -160,23 +160,23 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI DROP VIEW v1; DROP TABLE t1; EXPLAIN EXTENDED SELECT ''; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select NULL AS `NULL` EXPLAIN EXTENDED SELECT _latin1''; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select NULL AS `NULL` EXPLAIN EXTENDED SELECT N''; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select NULL AS `NULL` EXPLAIN EXTENDED SELECT '' ''; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select NULL AS `NULL` # diff --git a/mysql-test/main/endspace.result b/mysql-test/main/endspace.result index e7160f2829b..7eada7a411a 100644 --- a/mysql-test/main/endspace.result +++ b/mysql-test/main/endspace.result @@ -43,8 +43,8 @@ nothing teststring teststring explain select * from t1 order by text1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL key1 34 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL key1 34 NULL 3 Using index alter table t1 modify text1 char(32) binary not null; check table t1; Table Op Msg_type Msg_text @@ -99,8 +99,8 @@ concat('|', text1, '|') |teststring| |teststring | explain select concat('|', text1, '|') from t1 where text1='teststring '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref key1 key1 22 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref key1 key1 22 const 2 Using where select concat('|', text1, '|') from t1 where text1 like 'teststring_%'; concat('|', text1, '|') |teststring | @@ -153,8 +153,8 @@ nothing teststring teststring explain select * from t1 order by text1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using filesort alter table t1 modify text1 char(32) binary not null; select * from t1 order by text1; text1 @@ -181,8 +181,8 @@ nothing teststring teststring explain select * from t1 order by text1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL key1 34 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL key1 34 NULL 3 Using index alter table t1 modify text1 char(32) binary not null; select * from t1 order by text1; text1 diff --git a/mysql-test/main/error_simulation.result b/mysql-test/main/error_simulation.result index 457e5c8ec9c..1889c83039b 100644 --- a/mysql-test/main/error_simulation.result +++ b/mysql-test/main/error_simulation.result @@ -65,9 +65,9 @@ SET optimizer_switch='outer_join_with_cache=off'; SET SESSION debug_dbug= '+d,only_one_Unique_may_be_created'; EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x -x x x x x x x x x Using sort_union(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x +x x x x x x x x x x Using sort_union(a,b); Using where SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); a a b filler 0 1 1 data diff --git a/mysql-test/main/error_simulation.test b/mysql-test/main/error_simulation.test index f713e2da6ba..be9948f7fbc 100644 --- a/mysql-test/main/error_simulation.test +++ b/mysql-test/main/error_simulation.test @@ -80,7 +80,7 @@ SET optimizer_switch='outer_join_with_cache=off'; SET SESSION debug_dbug= '+d,only_one_Unique_may_be_created'; ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 ); diff --git a/mysql-test/main/except.result b/mysql-test/main/except.result index c88b91991f2..f8e709c03f8 100644 --- a/mysql-test/main/except.result +++ b/mysql-test/main/except.result @@ -7,23 +7,23 @@ insert into t2 values (2,2),(3,3); a b 1 1 EXPLAIN (select a,b from t1) except (select c,d from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 EXCEPT t2 ALL NULL NULL NULL NULL 2 -NULL EXCEPT RESULT <except1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 EXCEPT t2 NULL ALL NULL NULL NULL NULL 2 +NULL EXCEPT RESULT <except1,2> NULL ALL NULL NULL NULL NULL NULL EXPLAIN extended (select a,b from t1) except (select c,d from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 EXCEPT t2 ALL NULL NULL NULL NULL 2 100.00 -NULL EXCEPT RESULT <except1,2> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 EXCEPT t2 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL EXCEPT RESULT <except1,2> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) except (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) EXPLAIN extended select * from ((select a,b from t1) except (select c,d from t2)) a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 -3 EXCEPT t2 ALL NULL NULL NULL NULL 2 100.00 -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +3 EXCEPT t2 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) except (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`)) `a` EXPLAIN format=json (select a,b from t1) except (select c,d from t2); @@ -241,27 +241,27 @@ a b e f 1 1 5 5 2 2 5 5 EXPLAIN (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 EXCEPT t2 ALL NULL NULL NULL NULL 2 -2 EXCEPT t4 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -NULL EXCEPT RESULT <except1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 EXCEPT t2 NULL ALL NULL NULL NULL NULL 2 +2 EXCEPT t4 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +NULL EXCEPT RESULT <except1,2> NULL ALL NULL NULL NULL NULL NULL EXPLAIN (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 EXCEPT t2 ALL NULL NULL NULL NULL 2 -2 EXCEPT t4 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -NULL EXCEPT RESULT <except1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 EXCEPT t2 NULL ALL NULL NULL NULL NULL 2 +2 EXCEPT t4 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +NULL EXCEPT RESULT <except1,2> NULL ALL NULL NULL NULL NULL NULL EXPLAIN extended select * from ((select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4)) a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED t3 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) -3 EXCEPT t2 ALL NULL NULL NULL NULL 2 100.00 -3 EXCEPT t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +3 EXCEPT t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 EXCEPT t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b`,`a`.`e` AS `e`,`a`.`f` AS `f` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` join `test`.`t3`) except (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t4`.`g` AS `g`,`test`.`t4`.`h` AS `h` from `test`.`t2` join `test`.`t4`)) `a` EXPLAIN format=json (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4); diff --git a/mysql-test/main/except_all.result b/mysql-test/main/except_all.result index f74aeda5ab2..6360097cdb8 100644 --- a/mysql-test/main/except_all.result +++ b/mysql-test/main/except_all.result @@ -50,10 +50,10 @@ a b select * from (select * from t1 except all select * from t2) q1 except all select * from (select * from t1 except all select * from t2) q2; a b EXPLAIN select * from t1 except all select * from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 7 -2 EXCEPT t2 ALL NULL NULL NULL NULL 7 -NULL EXCEPT RESULT <except1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 7 +2 EXCEPT t2 NULL ALL NULL NULL NULL NULL 7 +NULL EXCEPT RESULT <except1,2> NULL ALL NULL NULL NULL NULL NULL EXPLAIN format=json select * from t1 except all select * from t2; EXPLAIN { @@ -98,18 +98,18 @@ EXPLAIN } } EXPLAIN extended (select * from t1) except all (select * from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 -2 EXCEPT t2 ALL NULL NULL NULL NULL 7 100.00 -NULL EXCEPT RESULT <except1,2> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 7 100.00 +2 EXCEPT t2 NULL ALL NULL NULL NULL NULL 7 100.00 +NULL EXCEPT RESULT <except1,2> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) except all (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) EXPLAIN extended select * from ((select * from t1) except all (select * from t2)) a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 7 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 -3 EXCEPT t2 ALL NULL NULL NULL NULL 7 100.00 -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 7 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 7 100.00 +3 EXCEPT t2 NULL ALL NULL NULL NULL NULL 7 100.00 +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) except all (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`)) `a` ANALYZE format=json select * from ((select a,b from t1) except all (select c,d from t2)) a; @@ -352,28 +352,28 @@ a b e 2 2 4 2 2 5 EXPLAIN (select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 EXCEPT t2 ALL NULL NULL NULL NULL 2 -2 EXCEPT t4 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -NULL EXCEPT RESULT <except1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 EXCEPT t2 NULL ALL NULL NULL NULL NULL 2 +2 EXCEPT t4 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +NULL EXCEPT RESULT <except1,2> NULL ALL NULL NULL NULL NULL NULL EXPLAIN select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 9 -2 DERIVED t1 ALL NULL NULL NULL NULL 3 -2 DERIVED t3 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -3 EXCEPT t2 ALL NULL NULL NULL NULL 2 -3 EXCEPT t4 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 9 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 +2 DERIVED t3 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +3 EXCEPT t2 NULL ALL NULL NULL NULL NULL 2 +3 EXCEPT t4 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL EXPLAIN extended select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 9 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 -2 DERIVED t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -3 EXCEPT t2 ALL NULL NULL NULL NULL 2 100.00 -3 EXCEPT t4 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 9 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DERIVED t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +3 EXCEPT t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 EXCEPT t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +NULL EXCEPT RESULT <except2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `t`.`a` AS `a`,`t`.`b` AS `b`,`t`.`e` AS `e`,`t`.`f` AS `f` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` join `test`.`t3`) except all (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t4`.`g` AS `g`,`test`.`t4`.`h` AS `h` from `test`.`t2` join `test`.`t4`)) `t` EXPLAIN format=json select * from ((select a,b,e,f from t1,t3) except all (select c,d,g,h from t2,t4)) t; diff --git a/mysql-test/main/explain.result b/mysql-test/main/explain.result index bc3c53d01d3..b451d08373c 100644 --- a/mysql-test/main/explain.result +++ b/mysql-test/main/explain.result @@ -1,8 +1,8 @@ drop table if exists t1; create table t1 (id int not null, str char(10), unique(str)); explain select * from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar"); select * from t1 where str is null; id str @@ -12,77 +12,77 @@ select * from t1 where str="foo"; id str 3 foo explain select * from t1 where str is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref str str 11 const 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref str str 11 const 2 Using index condition explain select * from t1 where str="foo"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const str str 11 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const str str 11 const 1 explain select * from t1 ignore key (str) where str="foo"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where explain select * from t1 use key (str,str) where str="foo"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const str str 11 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const str str 11 const 1 explain select * from t1 use key (str,str,foo) where str="foo"; ERROR 42000: Key 'foo' doesn't exist in table 't1' explain select * from t1 ignore key (str,str,foo) where str="foo"; ERROR 42000: Key 'foo' doesn't exist in table 't1' drop table t1; explain select 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used create table t1 (a int not null); explain select count(*) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away insert into t1 values(1); explain select count(*) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away insert into t1 values(1); explain select count(*) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away drop table t1; set names koi8r; create table ��� (���0 int, ���1 int, key ���0 (���0), key ���01 (���0,���1)); insert into ��� (���0) values (1); insert into ��� (���0) values (2); explain select ���0 from ��� where ���0=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE ��� ref ���0,���01 ���0 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE ��� NULL ref ���0,���01 ���0 5 const 1 Using index drop table ���; set names latin1; select 3 into @v1; explain select 3 into @v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used create table t1(f1 int, f2 int); insert into t1 values (1,1); create view v1 as select * from t1 where f1=1; explain extended select * from v1 where f2=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select 1 AS `f1`,1 AS `f2` from dual where 1 explain extended select * from t1 where 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2` from `test`.`t1` where 0 explain extended select * from t1 where 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select 1 AS `f1`,1 AS `f2` from dual where 1 explain extended select * from t1 having 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2` from `test`.`t1` having 0 explain extended select * from t1 having 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select 1 AS `f1`,1 AS `f2` from dual having 1 drop view v1; @@ -141,10 +141,10 @@ Note 1831 Duplicate index `b_40`. This is deprecated and will be disallowed in a INSERT INTO t2 VALUES (),(),(); EXPLAIN SELECT 1 FROM (SELECT 1 FROM t2,t1 WHERE b < c GROUP BY 1 LIMIT 1) AS d2; -id select_type table type possible_keys key key_len ref rows Extra -X X X X X X X X X -X X X X X X X X X -X X X X X X X X X Range checked for each record (index map: 0xFFFFFFFFFF) +id select_type table partitions type possible_keys key key_len ref rows Extra +X X X X X X X X X X +X X X X X X X X X X +X X X X X X X X X X Range checked for each record (index map: 0xFFFFFFFFFF) DROP TABLE t2; DROP TABLE t1; CREATE TABLE t1(a INT); @@ -153,45 +153,45 @@ INSERT INTO t1 VALUES (1),(2); INSERT INTO t2 VALUES (1),(2); EXPLAIN EXTENDED SELECT 1 FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort -2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select 1 AS `1` from (/* select#2 */ select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1` EXPLAIN EXTENDED SELECT 1 FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort -2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select 1 AS `1` from (/* select#2 */ select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1` prepare s1 from 'EXPLAIN EXTENDED SELECT 1 FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1'; execute s1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort -2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select 1 AS `1` from (/* select#2 */ select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1` prepare s1 from 'EXPLAIN EXTENDED SELECT 1 FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1'; execute s1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort -2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select 1 AS `1` from (/* select#2 */ select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1` execute s1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort -2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select 1 AS `1` from (/* select#2 */ select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1` DROP TABLE t1,t2; @@ -216,10 +216,10 @@ SELECT @@session.sql_mode INTO @old_sql_mode; SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 SUBQUERY t system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 SUBQUERY t NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 0 SET SESSION sql_mode=@old_sql_mode; @@ -237,17 +237,17 @@ SET @save_join_cache_level=@@join_cache_level; SET join_cache_level=0; flush tables; EXPLAIN SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN (SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.dt IS NULL ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY OUTR ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY INNR ALL NULL NULL NULL NULL 2 Using where; FirstMatch(OUTR) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY OUTR NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY INNR NULL ALL NULL NULL NULL NULL 2 Using where; FirstMatch(OUTR) flush tables; SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN (SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.dt IS NULL ); dt flush tables; EXPLAIN SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY OUTR ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY INNR ALL NULL NULL NULL NULL 2 Using where; FirstMatch(OUTR) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY OUTR NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY INNR NULL ALL NULL NULL NULL NULL 2 Using where; FirstMatch(OUTR) flush tables; SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' ); dt @@ -263,9 +263,9 @@ INSERT INTO t1 VALUES (NULL); CREATE TABLE t2 (d int); INSERT INTO t2 VALUES (NULL), (0); EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select (/* select#2 */ select 1 from `test`.`t2` where `test`.`t2`.`d` = NULL) AS `(SELECT 1 FROM t2 WHERE d = c)` from dual @@ -279,14 +279,14 @@ create table t2(f2 int); insert into t1 values(1); insert into t2 values(1),(2); explain extended select * from t1 where f1=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select 1 AS `f1` from dual where 1 explain extended select * from t1 join t2 on f1=f2 where f1=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select 1 AS `f1`,`test`.`t2`.`f2` AS `f2` from `test`.`t2` where `test`.`t2`.`f2` = 1 drop table t1,t2; @@ -298,9 +298,9 @@ CREATE TABLE t2 (b BLOB, KEY b(b(100))); INSERT INTO t2 VALUES ('1'), ('2'), ('3'); FLUSH TABLES; EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t1 t JOIN t2 WHERE b <= 1 AND t.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table DROP TABLE t1, t2; # # Bug #48573: difference of index selection between rpm binary and @@ -318,8 +318,8 @@ INSERT INTO t1 VALUES(9, 3, 1, 1); INSERT INTO t1 VALUES(10, 4, 1, 1); INSERT INTO t1 VALUES(11, 4, 1, 1); EXPLAIN SELECT c1 FROM t1 WHERE c2 = 1 AND c4 = 1 AND c5 = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c2,c2_2 c2 10 const,const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref c2,c2_2 c2 10 const,const 4 Using where DROP TABLE t1; # # Bug#56814 Explain + subselect + fulltext crashes server @@ -330,25 +330,25 @@ INSERT INTO t1 VALUES ('test'); EXPLAIN SELECT 1 FROM t1 WHERE 1 > ALL((SELECT t1.f1 FROM t1 JOIN t1 a ON (MATCH(t1.f1) AGAINST ("")) WHERE t1.f1 GROUP BY t1.f1)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 SUBQUERY a system NULL NULL NULL NULL 1 -2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 SUBQUERY a NULL system NULL NULL NULL NULL 1 +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 Using where PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 WHERE 1 > ALL((SELECT t1.f1 FROM t1 RIGHT OUTER JOIN t1 a ON (MATCH(t1.f1) AGAINST ("")) WHERE t1.f1 GROUP BY t1.f1))'; EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 SUBQUERY a system NULL NULL NULL NULL 1 -2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 SUBQUERY a NULL system NULL NULL NULL NULL 1 +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 Using where EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 SUBQUERY a system NULL NULL NULL NULL 1 -2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 SUBQUERY a NULL system NULL NULL NULL NULL 1 +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 Using where DEALLOCATE PREPARE stmt; PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 @@ -356,15 +356,15 @@ PREPARE stmt FROM ON (MATCH(t1.f1) AGAINST ("")) WHERE t1.f1 GROUP BY t1.f1))'; EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 SUBQUERY a system NULL NULL NULL NULL 1 -2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 SUBQUERY a NULL system NULL NULL NULL NULL 1 +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 Using where EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 SUBQUERY a system NULL NULL NULL NULL 1 -2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 SUBQUERY a NULL system NULL NULL NULL NULL 1 +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 Using where DEALLOCATE PREPARE stmt; DROP TABLE t1; End of 5.1 tests. @@ -392,9 +392,9 @@ set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; EXPLAIN EXTENDED SELECT * FROM ( SELECT t1.a FROM t1,t2 WHERE t2.a = t1.a ) AS t; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 0 0.00 Const row not found -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select NULL AS `a` from (/* select#2 */ select NULL AS `a` from `test`.`t1` where 0) `t` set optimizer_switch=@tmp_optimizer_switch; @@ -408,8 +408,8 @@ insert into t1 values (1); create table t2 (b int, c int); replace into t2 select 100, (select a from t1); explain replace into t2 select 100, (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 NULL system NULL NULL NULL NULL 1 drop table t1, t2; # End of 10.1 tests diff --git a/mysql-test/main/explain.test b/mysql-test/main/explain.test index 0fa4a5af215..bff5438d40d 100644 --- a/mysql-test/main/explain.test +++ b/mysql-test/main/explain.test @@ -88,7 +88,7 @@ INSERT INTO t2 VALUES (),(),(); # We only need to make sure that there is no buffer overrun and the index map # is displayed correctly ---replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X +--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X EXPLAIN SELECT 1 FROM (SELECT 1 FROM t2,t1 WHERE b < c GROUP BY 1 LIMIT 1) AS d2; DROP TABLE t2; diff --git a/mysql-test/main/explain_innodb.result b/mysql-test/main/explain_innodb.result index b46665c279c..14d3172af61 100644 --- a/mysql-test/main/explain_innodb.result +++ b/mysql-test/main/explain_innodb.result @@ -13,8 +13,8 @@ select 1; 1 explain SELECT * FROM (SELECT id FROM t1 GROUP BY id) dt WHERE 1=0; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 DERIVED t1 range NULL id 53 NULL 2 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DERIVED t1 NULL range NULL id 53 NULL 2 Using index for group-by SET GLOBAL slow_query_log = @sql_tmp; drop table t1; diff --git a/mysql-test/main/explain_json.result b/mysql-test/main/explain_json.result index a107fa3a6ff..4fbf7d546e4 100644 --- a/mysql-test/main/explain_json.result +++ b/mysql-test/main/explain_json.result @@ -780,9 +780,9 @@ EXPLAIN # explain select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 10 -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where; FirstMatch(t2); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 Using where; FirstMatch(t2); Using join buffer (flat, BNL join) explain format=json select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b); EXPLAIN @@ -823,9 +823,9 @@ set @tmp= @@optimizer_switch; set optimizer_switch='firstmatch=off'; explain select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 10 -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) explain format=json select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b); EXPLAIN @@ -1110,11 +1110,11 @@ DROP TABLE t1, t2; CREATE TABLE t1 (i INT); INSERT INTO t1 VALUES (1),(2); EXPLAIN SELECT * FROM t1 WHERE 3 IN ( SELECT 4 UNION SELECT 5 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL DROP TABLE t1; # # MDEV-7860: EXPLAIN FORMAT=JSON crashes for loose scan query @@ -1124,8 +1124,8 @@ insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t1 (a int, b int, c int, d int, key(a,b,c)); insert into t1 select A.a, B.a, C.a, D.a from t2 A, t2 B, t2 C, t2 D; explain select count(distinct b) from t1 group by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 10 NULL 101 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 10 NULL 101 Using index for group-by explain format=json select count(distinct b) from t1 group by a; EXPLAIN { @@ -1223,11 +1223,11 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date explain select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by explain select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 65 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 65 Using where; Using index for group-by explain format=json select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a'); EXPLAIN { @@ -1423,8 +1423,8 @@ drop table t0, t1, t2; create table t1 (i int) engine=myisam; explain select * from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found explain format=json select * from t1; EXPLAIN @@ -1463,9 +1463,9 @@ insert into t1 values (1),(2); insert into t2 values (1),(2); explain select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const PRIMARY NULL NULL NULL 1 Impossible ON condition -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const PRIMARY NULL NULL NULL 1 Impossible ON condition +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 explain format=json select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0; EXPLAIN @@ -1537,9 +1537,9 @@ ANALYZE # Check ET_NOT_EXISTS: explain select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index; Not exists explain format=json select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null; EXPLAIN @@ -1623,9 +1623,9 @@ ANALYZE # Check ET_DISTINCT explain select distinct t1.a from t1 join t2 on t2.pk=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where; Using temporary -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index; Distinct +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where; Using temporary +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index; Distinct explain format=json select distinct t1.a from t1 join t2 on t2.pk=t1.a; EXPLAIN @@ -1726,9 +1726,9 @@ set optimizer_switch='mrr=on'; set join_cache_level=6; explain select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t4 ref a a 5 test.t3.a 1 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t4 NULL ref a a 5 test.t3.a 1 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan explain format=json select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1); EXPLAIN diff --git a/mysql-test/main/explain_non_select.result b/mysql-test/main/explain_non_select.result index d1e7af6afde..50388d1f29c 100644 --- a/mysql-test/main/explain_non_select.result +++ b/mysql-test/main/explain_non_select.result @@ -5,51 +5,51 @@ insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8); # Tests for single-table DELETE # explain select * from t0 where a=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 Using where explain delete from t0 where a=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 Using where # DELETE without WHERE is a special case: explain delete from t0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL 8 Deleting all rows +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 8 Deleting all rows create table t1 (a int, b int, filler char(100), key(a), key(b)); insert into t1 select A.a+10*B.a + 10*C.a, A.a+10*B.a + 10*C.a, 'filler' from t0 A, t0 B, t0 C; # This should use an index, possible_keys=NULL because there is no WHERE explain delete from t1 order by a limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 2 # This should use range, possible_keys={a,b} explain delete from t1 where a<20 and b < 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a,b a 5 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a,b a 5 NULL 1 Using where # This should use ALL + filesort explain delete from t1 order by a+1 limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 512 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 512 Using filesort # This should use range + using filesort explain delete from t1 where a<20 order by b limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 1 Using where; Using filesort # Try some subqueries: explain delete from t1 where a < (select max(a) from t0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range a a 5 NULL 1 Using where -2 SUBQUERY t0 ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range a a 5 NULL 1 Using where +2 SUBQUERY t0 NULL ALL NULL NULL NULL NULL 8 explain delete from t1 where a < (select max(a) from t0 where a < t1.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 512 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 512 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 8 Using where # # Tests for multi-table DELETE # explain delete t1 from t0, t1 where t0.a = t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 8 Using where -1 SIMPLE t1 ref a a 5 test.t0.a 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 Using where +1 SIMPLE t1 NULL ref a a 5 test.t0.a 4 drop table t0, t1; # ################################################################### # ## EXPLAIN UPDATE tests @@ -57,50 +57,50 @@ drop table t0, t1; create table t0 (a int) engine=myisam; insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8); explain update t0 set a=3 where a=4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 Using where create table t1 (a int, b int, filler char(100), key(a), key(b)); insert into t1 select A.a+10*B.a + 10*C.a, A.a+10*B.a + 10*C.a, 'filler' from t0 A, t0 B, t0 C; explain update t1 set a=a+1 where 3>4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain update t1 set a=a+1 where a=3 and a=4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE # This should use an index, possible_keys=NULL because there is no WHERE explain update t1 set a=a+1 order by a limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 512 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 512 Using filesort # This should use range, possible_keys={a,b} explain update t1 set filler='fooo' where a<20 and b < 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a,b a 5 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a,b a 5 NULL 1 Using where # This should use ALL + filesort explain update t1 set filler='fooo' order by a+1 limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 512 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 512 Using filesort # This should use range + using filesort explain update t1 set filler='fooo' where a<20 order by b limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 1 Using where; Using filesort # Try some subqueries: explain update t1 set filler='fooo' where a < (select max(a) from t0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range a a 5 NULL 1 Using where -2 SUBQUERY t0 ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range a a 5 NULL 1 Using where +2 SUBQUERY t0 NULL ALL NULL NULL NULL NULL 8 explain update t1 set filler='fooo' where a < (select max(a) from t0 where a < t1.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 512 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 512 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 8 Using where # # Tests for multi-table UPDATE # explain update t0, t1 set t1.a=t1.a+1 where t0.a = t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 8 Using where -1 SIMPLE t1 ref a a 5 test.t0.a 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 Using where +1 SIMPLE t1 NULL ref a a 5 test.t0.a 4 drop table t0, t1; # # Try DELETE ... RETURNING ... @@ -108,11 +108,11 @@ drop table t0, t1; create table t0 (a int); insert into t0 values (1),(2),(3),(4); explain delete from t0 where a=1 returning a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 4 Using where explain delete from t0 returning a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 4 drop table t0; # # MDEV-5070 - EXPLAIN INSERT ... SELECT crashes on 10.0-base-explain-slowquerylog @@ -121,11 +121,11 @@ create table t0 (a int); insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8); create table t1 (a int); explain insert into t1 select * from t0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 explain replace into t1 select * from t0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 drop table t0, t1; # # MDEV-5067: Valgrind warnings (Invalid read) in QPF_table_access::print_explain @@ -155,11 +155,11 @@ explain partitions delete from t2 where a in (3,4); id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 2 Using where explain extended update t2 set b=3 where a in (3,4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 2 100.00 Using where explain extended delete from t2 where a in (3,4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 2 100.00 Using where drop table t1,t2; # # Check the special case where partition pruning removed all partitions @@ -186,17 +186,17 @@ drop table t1; # create table t1 (a int, key(a)); explain insert into t1 values (1),(2),(3); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL insert into t1 values (1),(2),(3); create table t2 (a int, b int); explain insert into t2 values (10, 1+(select max(a) from t1)), (11, 1+(select max(a+1) from t1)); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t2 ALL NULL NULL NULL NULL NULL NULL -3 SUBQUERY t1 index NULL a 5 NULL 3 Using index -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t2 NULL ALL NULL NULL NULL NULL NULL NULL +3 SUBQUERY t1 NULL index NULL a 5 NULL 3 Using index +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away drop table t1,t2; # # MDEV-5122: "Commands out of sync", "Malformed packet" or client hang up on unique key violation @@ -227,9 +227,9 @@ CREATE TABLE t1 (a INT); CREATE VIEW v1 AS SELECT * FROM t1; INSERT INTO t1 VALUES (1),(2); EXPLAIN UPDATE v1, mysql.user SET v1.a = v1.a + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE global_priv index NULL PRIMARY 1149 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE global_priv NULL index NULL PRIMARY 1149 NULL 5 Using index DROP TABLE t1; DROP VIEW v1; # @@ -240,8 +240,8 @@ INSERT INTO t1 (i) VALUES (100),(200); CREATE TABLE t2 (j INT) ENGINE=MyISAM; INSERT INTO t2 VALUES (10),(20); EXPLAIN INSERT INTO t1 (i) SELECT j FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 INSERT INTO t1 (i) VALUES (300); CHECK TABLE t1; Table Op Msg_type Msg_text @@ -257,10 +257,10 @@ INSERT INTO t1 VALUES (1),(2); INSERT INTO t2 VALUES (3),(4); INSERT INTO t3 VALUES (5),(6); EXPLAIN INSERT INTO t1 SELECT * FROM t2 UNION SELECT * FROM t3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -2 UNION t3 ALL NULL NULL NULL NULL 2 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +2 UNION t3 NULL ALL NULL NULL NULL NULL 2 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL drop table t1,t2,t3; # # MDEV-6223: Assertion `! is_set()' fails in Diagnostics_area::set_eof_status on EXPLAIN INSERT executed as a PS @@ -270,6 +270,6 @@ CREATE TABLE t2 (b INT) ENGINE = MyISAM; INSERT INTO t2 VALUES (1),(2); PREPARE stmt FROM 'EXPLAIN INSERT INTO t1 SELECT * FROM t2'; EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 drop table t1,t2; diff --git a/mysql-test/main/explain_slowquerylog.result b/mysql-test/main/explain_slowquerylog.result index 63da82b5288..557a7fa49c7 100644 --- a/mysql-test/main/explain_slowquerylog.result +++ b/mysql-test/main/explain_slowquerylog.result @@ -2,8 +2,8 @@ drop table if exists t0,t1; create table t0 (a int); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); explain select * from t0 where a < 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where # # MDEV-5045: Server crashes in QPF_query::print_explain with log_slow_verbosity='query_plan,explain' # diff --git a/mysql-test/main/ext_key_noPK_6794.result b/mysql-test/main/ext_key_noPK_6794.result index 59344522887..6ba6f57f672 100644 --- a/mysql-test/main/ext_key_noPK_6794.result +++ b/mysql-test/main/ext_key_noPK_6794.result @@ -10,6 +10,7 @@ explain select * from t1 where c2 = 1 order by c1; id 1 select_type SIMPLE table t1 +partitions NULL type ref possible_keys c2 key c2 diff --git a/mysql-test/main/fetch_first.result b/mysql-test/main/fetch_first.result index 69a0336d722..f1de2578050 100644 --- a/mysql-test/main/fetch_first.result +++ b/mysql-test/main/fetch_first.result @@ -680,8 +680,8 @@ group by first_name, last_name order by first_name offset 1 rows fetch first 2 rows with ties; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using temporary; Using filesort select first_name, last_name, sum(score) from t1 group by first_name, last_name @@ -717,14 +717,14 @@ from t1 order by first_name offset 1 rows fetch first 2 rows with ties; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL t1_name 206 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL t1_name 206 NULL 3 Using index explain select first_name, last_name from t1 order by first_name desc fetch first 2 rows with ties; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL t1_name 206 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL t1_name 206 NULL 2 Using index select first_name, last_name from t1 order by first_name @@ -781,8 +781,8 @@ from t1 where first_name != 'John' order by first_name fetch first 2 rows with ties; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range t1_name t1_name 103 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range t1_name t1_name 103 NULL 3 Using where; Using index select first_name, last_name from t1 where first_name != 'John' @@ -813,9 +813,9 @@ fetch first 2 rows with ties ) select * from temp_table order by first_name, last_name; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using filesort -2 DERIVED t1 range t1_name t1_name 103 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 Using filesort +2 DERIVED t1 NULL range t1_name t1_name 103 NULL 3 Using where; Using index with temp_table as ( select first_name, last_name from t1 @@ -1088,15 +1088,15 @@ explain select a, b, count(*) from t1 group by a, b order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 10 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 10 NULL 6 Using index explain select a, b, count(*) from t1 group by a, b order by a fetch first 1 rows with ties; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 10 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 10 NULL 1 Using index # # Test FETCH ... WITH TIES / ONLY with prepared statements # @@ -1341,8 +1341,8 @@ drop table t1; CREATE TABLE t1 (a INT); INSERT INTO t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); explain SELECT SQL_BUFFER_RESULT 1 AS f FROM t1 ORDER BY f FETCH NEXT 2 ROW WITH TIES; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using temporary SELECT SQL_BUFFER_RESULT 1 AS f FROM t1 ORDER BY f FETCH NEXT 2 ROW WITH TIES; f 1 diff --git a/mysql-test/main/fulltext.result b/mysql-test/main/fulltext.result index 6f294eb4631..cf2a27f71b2 100644 --- a/mysql-test/main/fulltext.result +++ b/mysql-test/main/fulltext.result @@ -14,8 +14,8 @@ a b Only MyISAM tables support collections Full-text indexes are called collections explain extended select * from t1 where MATCH(a,b) AGAINST ("collections"); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 fulltext a a 0 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL fulltext a a 0 1 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against ('collections')) select * from t1 where MATCH(a,b) AGAINST ("indexes"); @@ -51,41 +51,41 @@ Only MyISAM tables support collections select * from t1 where MATCH(a,b) AGAINST ("indexes" IN BOOLEAN MODE WITH QUERY EXPANSION); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH QUERY EXPANSION)' at line 1 explain select * from t1 where MATCH(a,b) AGAINST ("collections"); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 fulltext a a 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL fulltext a a 0 1 Using where explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 fulltext a a 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL fulltext a a 0 1 Using where explain select * from t1 where MATCH(a,b) AGAINST ("collections")>1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 fulltext a a 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL fulltext a a 0 1 Using where explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 fulltext a a 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL fulltext a a 0 1 Using where explain select * from t1 where 0<MATCH(a,b) AGAINST ("collections"); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 fulltext a a 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL fulltext a a 0 1 Using where explain select * from t1 where 1<MATCH(a,b) AGAINST ("collections"); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 fulltext a a 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL fulltext a a 0 1 Using where explain select * from t1 where 0<=MATCH(a,b) AGAINST ("collections"); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain select * from t1 where 1<=MATCH(a,b) AGAINST ("collections"); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 fulltext a a 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL fulltext a a 0 1 Using where explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0 and a like '%ll%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 fulltext a a 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL fulltext a a 0 1 Using where select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE); a b MySQL has now support for full-text search explain extended select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 fulltext a a 0 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL fulltext a a 0 1 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against ('support -collections' in boolean mode)) select * from t1 where MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE); @@ -510,28 +510,28 @@ INSERT INTO t1 VALUES('test', 5),('test', 6),('test', 7),('test', 8), ('test', 5),('test', 6),('test', 7),('test', 8); EXPLAIN SELECT * FROM t1 WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 fulltext b,a a 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL fulltext b,a a 0 1 Using where EXPLAIN SELECT * FROM t1 USE INDEX(a) WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 fulltext a a 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL fulltext a a 0 1 Using where EXPLAIN SELECT * FROM t1 FORCE INDEX(a) WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 fulltext a a 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL fulltext a a 0 1 Using where EXPLAIN SELECT * FROM t1 IGNORE INDEX(a) WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref b b 5 const 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref b b 5 const 5 Using where EXPLAIN SELECT * FROM t1 USE INDEX(b) WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref b b 5 const 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref b b 5 const 5 Using where EXPLAIN SELECT * FROM t1 FORCE INDEX(b) WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref b b 5 const 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref b b 5 const 5 Using where DROP TABLE t1; create table t1(a text,b date,fulltext index(a))engine=myisam; insert into t1 set a='water',b='2008-08-04'; @@ -601,10 +601,10 @@ not exists( SELECT 1 FROM t2, t3 WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t2 fulltext b2 b2 0 1 Using where -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t2 NULL fulltext b2 b2 0 1 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 Using where # should return 0 SELECT count(*) FROM t1 WHERE not exists( @@ -756,9 +756,9 @@ f1 f2 1 0 explain extended SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 /* select#1 */ select <expr_cache><'foo'>(<in_optimizer>('foo',<exists>(/* select#2 */ select `test`.`t1`.`f` from `test`.`t1` where <cache>(convert('foo' using latin1)) = `test`.`t1`.`f` or `test`.`t1`.`f` is null having `test`.`t1`.`f` is null))) AS `f1`,(match `test`.`t1`.`f` against ('qux' in boolean mode)) AS `f2` from `test`.`t1` drop table t1; diff --git a/mysql-test/main/fulltext_order_by.result b/mysql-test/main/fulltext_order_by.result index a350a55c75d..1131eb54042 100644 --- a/mysql-test/main/fulltext_order_by.result +++ b/mysql-test/main/fulltext_order_by.result @@ -64,8 +64,8 @@ match 1 match 1 alter table t1 add key m (message); explain SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 fulltext message message 0 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL fulltext message message 0 1 Using where; Using filesort SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message desc; message steve is cool diff --git a/mysql-test/main/func_analyse.result b/mysql-test/main/func_analyse.result index 1cb9e3c9ad8..ca346f65758 100644 --- a/mysql-test/main/func_analyse.result +++ b/mysql-test/main/func_analyse.result @@ -96,9 +96,9 @@ INSERT INTO t1 VALUES (),(); CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; #should have a derived table EXPLAIN SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 #should not crash SELECT * FROM v1 PROCEDURE analyse(); ERROR HY000: Incorrect usage of PROCEDURE and view diff --git a/mysql-test/main/func_compress.result b/mysql-test/main/func_compress.result index 065b68b4979..ff832e3d6ec 100644 --- a/mysql-test/main/func_compress.result +++ b/mysql-test/main/func_compress.result @@ -12,16 +12,16 @@ select uncompress(compress(@test_compress_string)); uncompress(compress(@test_compress_string)) string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa explain extended select uncompress(compress(@test_compress_string)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select uncompress(compress(@`test_compress_string`)) AS `uncompress(compress(@test_compress_string))` select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string); uncompressed_length(compress(@test_compress_string))=length(@test_compress_string) 1 explain extended select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select uncompressed_length(compress(@`test_compress_string`)) = octet_length(@`test_compress_string`) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)` select uncompressed_length(compress(@test_compress_string)); @@ -103,8 +103,8 @@ End of 4.1 tests create table t1 (a varchar(32) not null); insert into t1 values ('foo'); explain select * from t1 where uncompress(a) is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 Warnings: Warning 1259 ZLIB: Input data corrupted select * from t1 where uncompress(a) is null; @@ -113,8 +113,8 @@ foo Warnings: Warning 1259 ZLIB: Input data corrupted explain select *, uncompress(a) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 select *, uncompress(a) from t1; a uncompress(a) foo NULL diff --git a/mysql-test/main/func_concat.result b/mysql-test/main/func_concat.result index acde1be051b..16677d0a736 100644 --- a/mysql-test/main/func_concat.result +++ b/mysql-test/main/func_concat.result @@ -116,9 +116,9 @@ gui_AB str2 gui_ABC str3 EXPLAIN SELECT CONCAT('gui_', t2.a), t1.d FROM t2 LEFT JOIN t1 ON t1.a = CONCAT('gui_', t2.a) AND t1.b = 'a' AND t1.c = 'b'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL PRIMARY 102 NULL 3 Using index -1 SIMPLE t1 eq_ref PRIMARY,a PRIMARY 318 func,const,const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL PRIMARY 102 NULL 3 Using index +1 SIMPLE t1 NULL eq_ref PRIMARY,a PRIMARY 318 func,const,const 1 Using where DROP TABLE t1, t2; # # Bug #50096: CONCAT_WS inside procedure returning wrong data diff --git a/mysql-test/main/func_crypt.result b/mysql-test/main/func_crypt.result index 2c42d3dc845..085e16a7eac 100644 --- a/mysql-test/main/func_crypt.result +++ b/mysql-test/main/func_crypt.result @@ -88,8 +88,8 @@ select old_password(' i d k f a '); old_password(' i d k f a ') 5c078dc54ca0fcca explain extended select password('idkfa '), old_password('idkfa'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select password('idkfa ') AS `password('idkfa ')`,old_password('idkfa') AS `old_password('idkfa')` select encrypt('1234','_.'); diff --git a/mysql-test/main/func_debug.result b/mysql-test/main/func_debug.result index 08650fdd3c3..602ce86458d 100644 --- a/mysql-test/main/func_debug.result +++ b/mysql-test/main/func_debug.result @@ -1672,9 +1672,9 @@ SET SESSION debug_dbug="+d,Item_subselect"; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); EXPLAIN SELECT * FROM t1 WHERE a IN (1,2,(SELECT MAX(a) FROM t1)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where -2 SUBQUERY t1 ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 10 SELECT * FROM t1 WHERE a IN (1,2,(SELECT MAX(a) FROM t1)); a 1 diff --git a/mysql-test/main/func_default.result b/mysql-test/main/func_default.result index 8721270ca1c..8222944df28 100644 --- a/mysql-test/main/func_default.result +++ b/mysql-test/main/func_default.result @@ -5,16 +5,16 @@ select default(str), default(strnull), default(intg), default(rel) from t1; default(str) default(strnull) default(intg) default(rel) def NULL 10 3.14 explain extended select default(str), default(strnull), default(intg), default(rel) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select default(`test`.`t1`.`str`) AS `default(str)`,default(`test`.`t1`.`strnull`) AS `default(strnull)`,default(`test`.`t1`.`intg`) AS `default(intg)`,default(`test`.`t1`.`rel`) AS `default(rel)` from dual select * from t1 where str <> default(str); str strnull intg rel 0 0 explain select * from t1 where str <> default(str); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 create view v1 as select default(str), default(strnull), default(intg), default(rel) from t1; select * from v1; default(str) default(strnull) default(intg) default(rel) diff --git a/mysql-test/main/func_encrypt.result b/mysql-test/main/func_encrypt.result index 68c44231e43..17cd8d0f47e 100644 --- a/mysql-test/main/func_encrypt.result +++ b/mysql-test/main/func_encrypt.result @@ -179,8 +179,8 @@ NULL Warnings: Warning 1108 Incorrect parameters to procedure 'des_decrypt' explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_decrypt(des_encrypt("hello","hidden")); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select des_decrypt(des_encrypt('hello',4),'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt('hello','hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))` drop table if exists t1; @@ -200,8 +200,8 @@ CREATE TABLE t1 (a INT(6) ZEROFILL); INSERT INTO t1 VALUES (1),(2); EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND DES_ENCRYPT('test',a)=_latin1 'abc' COLLATE latin1_bin; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and des_encrypt('test',`test`.`t1`.`a`) = 'abc' DROP TABLE t1; diff --git a/mysql-test/main/func_gconcat.result b/mysql-test/main/func_gconcat.result index 328bbc953ab..798481d9062 100644 --- a/mysql-test/main/func_gconcat.result +++ b/mysql-test/main/func_gconcat.result @@ -14,8 +14,8 @@ grp group_concat(c) 2 b,c 3 E,C,D,d,d,D explain extended select grp,group_concat(c) from t1 group by grp; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 9 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 9 100.00 Using filesort Warnings: Note 1003 select `test`.`t1`.`grp` AS `grp`,group_concat(`test`.`t1`.`c` separator ',') AS `group_concat(c)` from `test`.`t1` group by `test`.`t1`.`grp` select grp,group_concat(a,c) from t1 group by grp; @@ -84,8 +84,8 @@ grp group_concat(distinct c order by c desc) 2 c,b 3 E,D,C explain extended select grp,group_concat(distinct c order by c desc) from t1 group by grp; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 9 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 9 100.00 Using filesort Warnings: Note 1003 select `test`.`t1`.`grp` AS `grp`,group_concat(distinct `test`.`t1`.`c` order by `test`.`t1`.`c` DESC separator ',') AS `group_concat(distinct c order by c desc)` from `test`.`t1` group by `test`.`t1`.`grp` select grp,group_concat(c order by c separator ",") from t1 group by grp; @@ -104,8 +104,8 @@ grp group_concat(distinct c order by c separator ",") 2 b,c 3 C,D,E explain extended select grp,group_concat(distinct c order by c separator ",") from t1 group by grp; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 9 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 9 100.00 Using filesort Warnings: Note 1003 select `test`.`t1`.`grp` AS `grp`,group_concat(distinct `test`.`t1`.`c` order by `test`.`t1`.`c` ASC separator ',') AS `group_concat(distinct c order by c separator ",")` from `test`.`t1` group by `test`.`t1`.`grp` select grp,group_concat(distinct c order by c desc separator ",") from t1 group by grp; @@ -511,8 +511,8 @@ d a b 7 2 3 8 2 3 explain select a, group_concat(b) from t1 group by a with rollup; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using filesort select a, group_concat(b) from t1 group by a with rollup; a group_concat(b) 1 3,4,2,1,2 @@ -989,11 +989,11 @@ CREATE TABLE t1 (f1 INT); INSERT INTO t1 VALUES (),(); EXPLAIN EXTENDED SELECT 1 FROM (SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort -2 DERIVED td ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +2 DERIVED td NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select 1 AS `1` from (/* select#2 */ select distinct group_concat(`test`.`td`.`f1` separator ',') AS `GROUP_CONCAT(td.f1)` from `test`.`t1` join `test`.`t1` `td` group by `test`.`td`.`f1`) `d` join `test`.`t1` SELECT 1 FROM @@ -1011,10 +1011,10 @@ INSERT INTO t1 VALUES (0), (0); EXPLAIN EXTENDED SELECT 1 FROM (SELECT GROUP_CONCAT(t1.a ORDER BY t1.a ASC) FROM t1 t2, t1 GROUP BY t1.a) AS d; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select 1 AS `1` from (/* select#2 */ select group_concat(`test`.`t1`.`a` order by `test`.`t1`.`a` ASC separator ',') AS `GROUP_CONCAT(t1.a ORDER BY t1.a ASC)` from `test`.`t1` `t2` join `test`.`t1` group by `test`.`t1`.`a`) `d` DROP TABLE t1; diff --git a/mysql-test/main/func_group.result b/mysql-test/main/func_group.result index 3a779b2835f..c176e9959f2 100644 --- a/mysql-test/main/func_group.result +++ b/mysql-test/main/func_group.result @@ -198,11 +198,11 @@ select max(t2.a2), max(t1.a1) from t1, t2; max(t2.a2) max(t1.a1) NULL NULL explain select min(a2) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select max(t1.a1), max(t2.a2) from t1, t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No matching min/max row insert into t2 values('AAA', 10, 0.5); insert into t2 values('BBB', 20, 1.0); select t1.a1, t1.a2, t2.a1, t2.a2 from t1,t2; @@ -290,8 +290,8 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b) bit_xor(b) 2 1 1 1.00000 0.00000 1 1 1 1 1 3 1 1 1.00000 0.00000 1 1 1 1 1 explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using filesort Warnings: Note 1003 select sql_big_result `test`.`t1`.`a` AS `a`,count(`test`.`t1`.`b`) AS `count(b)`,sum(`test`.`t1`.`b`) AS `sum(b)`,avg(`test`.`t1`.`b`) AS `avg(b)`,std(`test`.`t1`.`b`) AS `std(b)`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)`,bit_and(`test`.`t1`.`b`) AS `bit_and(b)`,bit_or(`test`.`t1`.`b`) AS `bit_or(b)`,bit_xor(`test`.`t1`.`b`) AS `bit_xor(b)` from `test`.`t1` group by `test`.`t1`.`a` drop table t1; @@ -379,282 +379,282 @@ LAK Los Angeles CA TWU AAA AAA AA AME explain select min(a1) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(a1) from t1; min(a1) AME explain select max(a4) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select max(a4) from t1; max(a4) 0.1 explain select min(a5), max(a5) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(a5), max(a5) from t1; min(a5) max(a5) 1942-02-19 1977-09-23 explain select min(a3) from t1 where a2 = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(a3) from t1 where a2 = 2; min(a3) CHI explain select min(a1), max(a1) from t1 where a4 = 0.080; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(a1), max(a1) from t1 where a4 = 0.080; min(a1) max(a1) BDL TWU explain select min(t1.a5), max(t2.a3) from t1, t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(t1.a5), max(t2.a3) from t1, t2; min(t1.a5) max(t2.a3) 1942-02-19 WA explain select min(t1.a3), max(t2.a2) from t1, t2 where t1.a2 = 0 and t2.a3 = 'CA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(t1.a3), max(t2.a2) from t1, t2 where t1.a2 = 0 and t2.a3 = 'CA'; min(t1.a3) max(t2.a2) DEN San Diego explain select min(a1) from t1 where a1 > 'KKK'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(a1) from t1 where a1 > 'KKK'; min(a1) PLS explain select min(a1) from t1 where a1 >= 'KKK'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(a1) from t1 where a1 >= 'KKK'; min(a1) KKK explain select max(a3) from t1 where a2 = 2 and a3 < 'SEA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select max(a3) from t1 where a2 = 2 and a3 < 'SEA'; max(a3) MIN explain select max(a5) from t1 where a5 < date'1970-01-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select max(a5) from t1 where a5 < date'1970-01-01'; max(a5) 1969-10-05 explain select max(a3) from t1 where a2 is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select max(a3) from t1 where a2 is null; max(a3) MIN explain select max(a3) from t1 where a2 = 0 and a3 between 'K' and 'Q'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select max(a3) from t1 where a2 = 0 and a3 between 'K' and 'Q'; max(a3) LAX explain select min(a1), max(a1) from t1 where a1 between 'A' and 'P'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(a1), max(a1) from t1 where a1 between 'A' and 'P'; min(a1) max(a1) AME KKK explain select max(a3) from t1 where a3 < 'SEA' and a2 = 2 and a3 <= 'MIN'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select max(a3) from t1 where a3 < 'SEA' and a2 = 2 and a3 <= 'MIN'; max(a3) MIN explain select max(a3) from t1 where a3 = 'MIN' and a2 = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select max(a3) from t1 where a3 = 'MIN' and a2 = 2; max(a3) MIN explain select max(a3) from t1 where a3 = 'DEN' and a2 = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No matching min/max row select max(a3) from t1 where a3 = 'DEN' and a2 = 2; max(a3) NULL explain select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 = 'CA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 = 'CA'; max(t1.a3) min(t2.a2) CHI Los Angeles explain select max(a3) from t1 where a2 is null and a2 = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE select max(a3) from t1 where a2 is null and a2 = 2; max(a3) NULL explain select max(a2) from t1 where a2 >= 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select max(a2) from t1 where a2 >= 1; max(a2) 3 explain select min(a3) from t1 where a2 = 2 and a3 < 'SEA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(a3) from t1 where a2 = 2 and a3 < 'SEA'; min(a3) CHI explain select min(a3) from t1 where a2 = 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No matching min/max row select min(a3) from t1 where a2 = 4; min(a3) NULL explain select min(a3) from t1 where a2 = 2 and a3 > 'SEA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No matching min/max row select min(a3) from t1 where a2 = 2 and a3 > 'SEA'; min(a3) NULL explain select (min(a4)+max(a4))/2 from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select (min(a4)+max(a4))/2 from t1; (min(a4)+max(a4))/2 0.085 explain select min(a3) from t1 where 2 = a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(a3) from t1 where 2 = a2; min(a3) CHI explain select max(a3) from t1 where a2 = 2 and 'SEA' > a3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select max(a3) from t1 where a2 = 2 and 'SEA' > a3; max(a3) MIN explain select max(a3) from t1 where a2 = 2 and 'SEA' < a3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No matching min/max row select max(a3) from t1 where a2 = 2 and 'SEA' < a3; max(a3) NULL explain select min(a3) from t1 where a2 = 2 and a3 >= 'CHI'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(a3) from t1 where a2 = 2 and a3 >= 'CHI'; min(a3) CHI explain select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 < 'SEA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 < 'SEA'; min(a3) CHI explain select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 = 'MIN'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 = 'MIN'; min(a3) MIN explain select min(a3) from t1 where a2 = 2 and a3 >= 'SEA' and a3 = 'MIN'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE select min(a3) from t1 where a2 = 2 and a3 >= 'SEA' and a3 = 'MIN'; min(a3) NULL explain select min(t1.a1), min(t2.a4) from t1,t2 where t1.a1 < 'KKK' and t2.a4 < 'KKK'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(t1.a1), min(t2.a4) from t1,t2 where t1.a1 < 'KKK' and t2.a4 < 'KKK'; min(t1.a1) min(t2.a4) AME AME explain select min(a1) from t1 where a1 > 'KKK' or a1 < 'XXX'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 3 NULL 15 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 3 NULL 15 Using where; Using index explain select min(a1) from t1 where (a1 < 'KKK' or a1 > 'KKK'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 3 NULL 14 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 3 NULL 14 Using where; Using index explain select max(a3) from t1 where a2 < 2 and a3 < 'SEA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range k1 k1 3 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range k1 k1 3 NULL 7 Using where; Using index explain select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'DEN' and t2.a3 >= 'LA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range k1 k1 7 NULL 1 Using where; Using index -1 SIMPLE t2 range k1 k1 3 NULL 2 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range k1 k1 7 NULL 1 Using where; Using index +1 SIMPLE t2 NULL range k1 k1 3 NULL 2 Using where; Using index; Using join buffer (flat, BNL join) explain select min(a4 - 0.01) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL k2 12 NULL 15 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL k2 12 NULL 15 Using index explain select max(a4 + 0.01) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL k2 12 NULL 15 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL k2 12 NULL 15 Using index explain select min(a3) from t1 where (a2 +1 ) is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL k1 7 NULL 15 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL k1 7 NULL 15 Using where; Using index explain select min(a3) from t1 where (a2 + 1) = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL k1 7 NULL 15 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL k1 7 NULL 15 Using where; Using index explain select min(a3) from t1 where 2 = (a2 + 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL k1 7 NULL 15 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL k1 7 NULL 15 Using where; Using index explain select min(a2) from t1 where a2 < 2 * a2 - 8; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL k1 7 NULL 15 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL k1 7 NULL 15 Using where; Using index explain select min(a1) from t1 where a1 between a3 and 'KKK'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 15 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 15 Using where explain select min(a4) from t1 where (a4 + 0.01) between 0.07 and 0.08; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL k2 12 NULL 15 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL k2 12 NULL 15 Using where; Using index explain select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range k2 k2 4 NULL 6 Using where; Using index -1 SIMPLE t1 index NULL PRIMARY 3 NULL 15 Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range k2 k2 4 NULL 6 Using where; Using index +1 SIMPLE t1 NULL index NULL PRIMARY 3 NULL 15 Using index; Using join buffer (flat, BNL join) drop table t1, t2; create table t1 (a char(10)); insert into t1 values ('a'),('b'),('c'); @@ -836,8 +836,8 @@ SELECT MAX(b) FROM t1; MAX(b) xxxxbbbb EXPLAIN SELECT MAX(b) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 DROP TABLE t1; CREATE TABLE t1 (id int , b varchar(512), INDEX(b(250))) COLLATE latin1_bin; INSERT INTO t1 VALUES @@ -847,8 +847,8 @@ SELECT MAX(b) FROM t1; MAX(b) __________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________zz EXPLAIN SELECT MAX(b) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 DROP TABLE t1; CREATE TABLE t1 (a INT, b INT); INSERT INTO t1 VALUES (1,1),(1,2),(2,3); @@ -1327,8 +1327,8 @@ DROP TABLE t1; CREATE TABLE t1 ( a INT, b INT, KEY(a) ); INSERT INTO t1 VALUES (NULL, 1), (NULL, 2); EXPLAIN SELECT MIN(a), MIN(b) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 SELECT MIN(a), MIN(b) FROM t1; MIN(a) MIN(b) NULL 1 @@ -1336,24 +1336,24 @@ CREATE TABLE t2( a INT, b INT, c INT, KEY(a, b) ); INSERT INTO t2 ( a, b, c ) VALUES ( 1, NULL, 2 ), ( 1, 3, 4 ), ( 1, 4, 4 ), ( 2, NULL, 2 ), ( 2, 3, 4 ), ( 2, 4, 4 ); EXPLAIN SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 5 const 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref a a 5 const 3 SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1; MIN(b) MIN(c) 3 2 CREATE TABLE t3 (a INT, b INT, c int, KEY(a, b)); INSERT INTO t3 VALUES (1, NULL, 1), (2, NULL, 2), (2, NULL, 2), (3, NULL, 3); EXPLAIN SELECT MIN(a), MIN(b) FROM t3 where a = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT MIN(a), MIN(b) FROM t3 where a = 2; MIN(a) MIN(b) 2 NULL CREATE TABLE t4 (a INT, b INT, c int, KEY(a, b)); INSERT INTO t4 VALUES (1, 1, 1), (2, NULL, 2), (2, NULL, 2), (3, 1, 3); EXPLAIN SELECT MIN(a), MIN(b) FROM t4 where a = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT MIN(a), MIN(b) FROM t4 where a = 2; MIN(a) MIN(b) 2 NULL @@ -1363,8 +1363,8 @@ NULL 2 CREATE TABLE t5( a INT, b INT, KEY( a, b) ); INSERT INTO t5 VALUES( 1, 1 ), ( 1, 2 ); EXPLAIN SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1; MIN(a) MIN(b) 1 1 @@ -1407,8 +1407,8 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3),(4); CREATE VIEW v1 AS SELECT a,(a + 1) AS y FROM t1; EXPLAIN EXTENDED SELECT y FROM v1 GROUP BY v1.y; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort Warnings: Note 1003 select `test`.`t1`.`a` + 1 AS `y` from `test`.`t1` group by `test`.`t1`.`a` + 1 DROP VIEW v1; @@ -1519,8 +1519,8 @@ EXPLAIN SELECT MAX(pk) as max, i FROM t1 ORDER BY max; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 # Only 11 is correct for collumn i in this result SELECT MAX(pk) as max, i @@ -1846,9 +1846,9 @@ INSERT INTO t2 VALUES (8,2), (6,9), (8,4), (5,3), (9,1); EXPLAIN EXTENDED SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<8; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where 0 SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<10; @@ -1856,10 +1856,10 @@ MAX(a) NULL EXPLAIN EXTENDED SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT a,b FROM t2 WHERE b<5) and a<10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00 -1 PRIMARY t1 range a a 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +1 PRIMARY t1 NULL range a a 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`a` = 1 and `test`.`t2`.`b` = 2 and `test`.`t1`.`a` < 10 SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT a,b FROM t2 WHERE b<5) and a<10; @@ -1867,8 +1867,8 @@ MAX(a) NULL EXPLAIN EXTENDED SELECT MAX(a) FROM t1 WHERE RAND()*0<>0 AND a<10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 4 NULL 3 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 4 NULL 3 100.00 Using where; Using index Warnings: Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where rand() * 0 <> 0 and `test`.`t1`.`a` < 10 SELECT MAX(a) FROM t1 WHERE RAND()*0<>0 AND a<10; @@ -1886,10 +1886,10 @@ CREATE TABLE t3 ( a int, b int); INSERT INTO t3 VALUES (19,1), (20,5); EXPLAIN EXTENDED SELECT (SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b) FROM t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1276 Field or reference 'test.t3.b' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select <expr_cache><`test`.`t3`.`b`>((/* select#2 */ select min(1) from dual where 10 = `test`.`t3`.`b`)) AS `(SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b)` from `test`.`t3` @@ -1905,43 +1905,43 @@ CREATE TABLE t1 (f1 varchar(1), f2 varchar(1), KEY (f2)); INSERT INTO t1 VALUES ('b', 'b'), ('a','a'); EXPLAIN SELECT MAX(f1) FROM t1 WHERE f1 = 'abc'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT MAX(f1) FROM t1 WHERE f1 = 'abc'; MAX(f1) NULL EXPLAIN SELECT MAX(f2) FROM t1 WHERE f2 = 'abc'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref f2 f2 4 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref f2 f2 4 const 1 Using where; Using index SELECT MAX(f2) FROM t1 WHERE f2 = 'abc'; MAX(f2) NULL EXPLAIN SELECT MIN(f1) FROM t1 WHERE f1 >= 'abc'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT MIN(f1) FROM t1 WHERE f1 >= 'abc'; MIN(f1) b EXPLAIN SELECT MIN(f2) FROM t1 WHERE f2 >= 'abc'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range f2 f2 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range f2 f2 4 NULL 1 Using where; Using index SELECT MIN(f2) FROM t1 WHERE f2 >= 'abc'; MIN(f2) b EXPLAIN SELECT MIN(f1) FROM t1 WHERE f1 BETWEEN 'abc' AND 'b' ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT MIN(f1) FROM t1 WHERE f1 BETWEEN 'abc' AND 'b' ; MIN(f1) b EXPLAIN SELECT MIN(f2) FROM t1 WHERE f2 BETWEEN 'abc' AND 'b' ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range f2 f2 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range f2 f2 4 NULL 1 Using where; Using index SELECT MIN(f2) FROM t1 WHERE f2 BETWEEN 'abc' AND 'b' ; MIN(f2) b @@ -1991,9 +1991,9 @@ WHERE 'j' HAVING ('m') IN ( SELECT v FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'j' Warning 1292 Truncated incorrect DOUBLE value: 'j' @@ -2019,9 +2019,9 @@ WHERE t2.pk>10 HAVING ('m') IN ( SELECT v FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No matching min/max row -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No matching min/max row +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 # # 3) Test that subquery materialization is setup for query with @@ -2043,9 +2043,9 @@ WHERE pk=NULL HAVING ('m') IN ( SELECT v FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 # # 4) Test that subquery materialization is setup for query with @@ -2068,10 +2068,10 @@ FROM (SELECT a FROM empty1) tt HAVING ('m') IN ( SELECT v FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 0 Const row not found +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table set optimizer_switch=@tmp_optimizer_switch; # @@ -2095,10 +2095,10 @@ WHERE t1.pk IN (SELECT 1 from t3 where pk>10) HAVING ('m') IN ( SELECT v FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 2 Using where; Using index -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 2 Using where; Using index +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables set @@optimizer_switch=@save_optimizer_switch; # # Cleanup for BUG#46680 @@ -2221,15 +2221,15 @@ INSERT INTO `t1` (b) VALUES ('2013-06-06 23:59:59'); INSERT INTO `t1` (b) VALUES ('2013-07-06 23:59:59'); # The following should produce "Select tables optimized away" EXPLAIN SELECT MIN(b) FROM t1 WHERE b <= '2013-11-06 23:59:59'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away connect con1,localhost,root,,; connection con1; set names utf8; # Should be the same as above: EXPLAIN SELECT MIN(b) FROM t1 WHERE b <= '2013-11-06 23:59:59'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away connection default; disconnect con1; DROP TABLE t1; @@ -2246,8 +2246,8 @@ insert into t1 (b) values (INET_ATON('192.168.0.4')); insert into t1 (b) values (INET_ATON('192.168.200.200')); # should show "Select tables optimized away" explain select MIN(b) from t1 where b >= inet_aton('192.168.119.32'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away DROP TABLE t1; # # MDEV-6743 crash in GROUP_CONCAT(IF () ORDER BY 1) @@ -2394,11 +2394,11 @@ insert into t10 values (0,0,0),(1,1,1); create table t11 as select * from t10; create table t12 as select * from t10; explain extended select a from t10 where c<3 or a in (select c from t12 union select max(t10.b) from t11 group by t11.c); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t10 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t12 ALL NULL NULL NULL NULL 2 100.00 Using where -3 DEPENDENT UNION t11 ALL NULL NULL NULL NULL 2 100.00 Using temporary -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t10 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t12 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION t11 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t10.b' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t10`.`a` AS `a` from `test`.`t10` where `test`.`t10`.`c` < 3 or <expr_cache><`test`.`t10`.`a`,`test`.`t10`.`b`>(<in_optimizer>(`test`.`t10`.`a`,<exists>(/* select#2 */ select `test`.`t12`.`c` from `test`.`t12` where <cache>(`test`.`t10`.`a`) = `test`.`t12`.`c` union /* select#3 */ select max(`test`.`t10`.`b`) from `test`.`t11` group by `test`.`t11`.`c` having <cache>(`test`.`t10`.`a`) = <ref_null_helper>(max(`test`.`t10`.`b`))))) @@ -2426,10 +2426,10 @@ select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min( ERROR HY000: Invalid use of group function explain extended select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+tt.c1) from t2 tt)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -2 DEPENDENT SUBQUERY t system NULL NULL NULL NULL 1 100.00 -3 DEPENDENT SUBQUERY tt system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DEPENDENT SUBQUERY t NULL system NULL NULL NULL NULL 1 100.00 +3 DEPENDENT SUBQUERY tt NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1276 Field or reference 'test.t1.c1' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` having `test`.`t1`.`c1` >= <expr_cache><`test`.`t1`.`c1`>((/* select#2 */ select 2 AS `c` from dual order by (/* select#3 */ select min(`test`.`t1`.`c1` + 2) from dual))) @@ -2468,27 +2468,27 @@ select max(a) from t1 where a < 303 and (a between 267 AND 287); max(a) 287 explain select max(a) from t1 where a < 303 and (a between 267 AND 287); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where select min(a) from t1 where a > 267 and (a between 273 AND 303); min(a) 273 explain select min(a) from t1 where a > 267 and (a between 273 AND 303); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where create index idx on t1(a); select max(a) from t1 where a < 303 and (a between 267 AND 287); max(a) 287 explain select max(a) from t1 where a < 303 and (a between 267 AND 287); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(a) from t1 where a > 267 and (a between 273 AND 303); min(a) 273 explain select min(a) from t1 where a > 267 and (a between 273 AND 303); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away drop table t1; # # End of 10.2 tests diff --git a/mysql-test/main/func_group_innodb.result b/mysql-test/main/func_group_innodb.result index f5a823e4638..93d69a88ece 100644 --- a/mysql-test/main/func_group_innodb.result +++ b/mysql-test/main/func_group_innodb.result @@ -28,8 +28,8 @@ select min(7) from DUAL; min(7) 7 explain select min(7) from t2m join t1m; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(7) from t2m join t1m; min(7) NULL @@ -43,8 +43,8 @@ select max(7) from DUAL; max(7) 7 explain select max(7) from t2m join t1m; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select max(7) from t2m join t1m; max(7) NULL @@ -82,9 +82,9 @@ select min(7) from DUAL; min(7) 7 explain select min(7) from t2i join t1i; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2i ALL NULL NULL NULL NULL 1 -1 SIMPLE t1i ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2i NULL ALL NULL NULL NULL NULL 1 +1 SIMPLE t1i NULL ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) select min(7) from t2i join t1i; min(7) NULL @@ -98,9 +98,9 @@ select max(7) from DUAL; max(7) 7 explain select max(7) from t2i join t1i; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2i ALL NULL NULL NULL NULL 1 -1 SIMPLE t1i ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2i NULL ALL NULL NULL NULL NULL 1 +1 SIMPLE t1i NULL ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) select max(7) from t2i join t1i; max(7) NULL @@ -129,23 +129,23 @@ select 1, max(1) from t1i where 1=99; 1 max(1) 1 NULL explain select count(*), min(7), max(7) from t1m, t1i; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE t1i ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1m NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t1i NULL ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t1m, t1i; count(*) min(7) max(7) 0 NULL NULL explain select count(*), min(7), max(7) from t1m, t2i; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1m system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE t2i ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1m NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t2i NULL ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t1m, t2i; count(*) min(7) max(7) 0 NULL NULL explain select count(*), min(7), max(7) from t2m, t1i; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2m system NULL NULL NULL NULL 1 -1 SIMPLE t1i ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2m NULL system NULL NULL NULL NULL 1 +1 SIMPLE t1i NULL ALL NULL NULL NULL NULL 1 select count(*), min(7), max(7) from t2m, t1i; count(*) min(7) max(7) 0 NULL NULL @@ -250,8 +250,8 @@ SELECT MIN(c) FROM t1 GROUP BY b; MIN(c) 0 EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL b 263 NULL 2 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL b 263 NULL 2 Using index for group-by DROP TABLE t1; # # MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field @@ -261,8 +261,8 @@ KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC; INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go'); explain SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; MIN(t1.v1) king @@ -271,8 +271,8 @@ CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB INSERT INTO t1 VALUES ('king'), ('bad'); explain SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No matching min/max row SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; MIN(x.v1) NULL diff --git a/mysql-test/main/func_if.result b/mysql-test/main/func_if.result index 09eb85d9fb6..30a5050ee74 100644 --- a/mysql-test/main/func_if.result +++ b/mysql-test/main/func_if.result @@ -40,8 +40,8 @@ a aa aaa explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order by s; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using where; Using filesort Warnings: Note 1003 select if(`test`.`t1`.`u` = 1,`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) AS `s` from `test`.`t1` where `test`.`t1`.`st` like '%a%' order by if(`test`.`t1`.`u` = 1,`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) select nullif(u, 1) from t1; @@ -54,8 +54,8 @@ NULL 0 0 explain extended select nullif(u, 1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 100.00 Warnings: Note 1003 select nullif(`test`.`t1`.`u`,1) AS `nullif(u, 1)` from `test`.`t1` drop table t1; diff --git a/mysql-test/main/func_in.result b/mysql-test/main/func_in.result index 569fdfe4cbf..1184eef4a6c 100644 --- a/mysql-test/main/func_in.result +++ b/mysql-test/main/func_in.result @@ -143,8 +143,8 @@ select * from t1 where 'a' in (a,b,c collate latin1_bin); a b c a c c explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 'a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,`test`.`t1`.`c` collate latin1_bin) drop table t1; @@ -240,8 +240,8 @@ insert into t2 select C.a*2, 'no' from t1 A, t1 B, t1 C; insert into t2 select C.a*2+1, 'yes' from t1 C; explain select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 5 NULL 11 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 5 NULL 11 Using index condition select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18); a filler 1 yes @@ -255,11 +255,11 @@ a filler 17 yes 19 yes explain select * from t2 force index(a) where a NOT IN (2,2,2,2,2,2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 5 NULL 912 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 5 NULL 912 Using index condition explain select * from t2 force index(a) where a <> 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 5 NULL 912 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 5 NULL 912 Using index condition drop table t2; create table t2 (a datetime, filler char(200), key(a)); insert into t2 select '2006-04-25 10:00:00' + interval C.a minute, @@ -270,8 +270,8 @@ explain select * from t2 where a NOT IN ( '2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00', '2006-04-25 10:06:00', '2006-04-25 10:08:00'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 6 NULL 11 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 6 NULL 11 Using index condition select * from t2 where a NOT IN ( '2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00', '2006-04-25 10:06:00', '2006-04-25 10:08:00'); @@ -294,8 +294,8 @@ insert into t2 select 'bazbazbaz', 'no' from t1 A, t1 B; insert into t2 values ('fon', '1'), ('fop','1'), ('barbaq','1'), ('barbas','1'), ('bazbazbay', '1'),('zz','1'); explain select * from t2 where a not in('foo','barbar', 'bazbazbaz'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 13 NULL 6 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 13 NULL 6 Using index condition drop table t2; create table t2 (a decimal(10,5), filler char(200), key(a)); insert into t2 select 345.67890, 'no' from t1 A, t1 B; @@ -305,8 +305,8 @@ insert into t2 values (0, '1'), (22334.123,'1'), (33333,'1'), (55555,'1'), (77777, '1'); explain select * from t2 where a not in (345.67890, 43245.34, 64224.56344); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 7 NULL 6 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 7 NULL 6 Using index condition select * from t2 where a not in (345.67890, 43245.34, 64224.56344); a filler 0.00000 1 @@ -368,11 +368,11 @@ EXPLAIN SELECT STRAIGHT_JOIN * FROM t3 JOIN t1 ON t3.a=t1.a JOIN t2 ON t3.a=t2.a JOIN t4 WHERE t4.a IN (t1.b, t2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index PRIMARY PRIMARY 4 NULL 4 Using index -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.a 1 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.a 1 -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 7 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL index PRIMARY PRIMARY 4 NULL 4 Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.a 1 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t3.a 1 +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 7 Range checked for each record (index map: 0x1) SELECT STRAIGHT_JOIN * FROM t3 JOIN t1 ON t3.a=t1.a JOIN t2 ON t3.a=t2.a @@ -386,11 +386,11 @@ EXPLAIN SELECT STRAIGHT_JOIN (SELECT SUM(t4.a) FROM t4 WHERE t4.a IN (t1.b, t2.b)) FROM t3, t1, t2 WHERE t3.a=t1.a AND t3.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 4 Using index -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.a 1 -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t3.a 1 -2 DEPENDENT SUBQUERY t4 index NULL PRIMARY 4 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL index PRIMARY PRIMARY 4 NULL 4 Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.a 1 +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t3.a 1 +2 DEPENDENT SUBQUERY t4 NULL index NULL PRIMARY 4 NULL 7 Using where; Using index SELECT STRAIGHT_JOIN (SELECT SUM(t4.a) FROM t4 WHERE t4.a IN (t1.b, t2.b)) FROM t3, t1, t2 @@ -514,15 +514,15 @@ a Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'b' explain select f1 from t1 where f1 in ('a',1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index t1f1_idx t1f1_idx 2 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index t1f1_idx t1f1_idx 2 NULL 3 Using where; Using index select f1 from t1 where f1 in ('a','b'); f1 a b explain select f1 from t1 where f1 in ('a','b'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range t1f1_idx t1f1_idx 2 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range t1f1_idx t1f1_idx 2 NULL 2 Using where; Using index select f1 from t1 where f1 in (2,1); f1 1 @@ -530,8 +530,8 @@ Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'a' Warning 1292 Truncated incorrect DOUBLE value: 'b' explain select f1 from t1 where f1 in (2,1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index t1f1_idx t1f1_idx 2 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index t1f1_idx t1f1_idx 2 NULL 3 Using where; Using index create table t2(f2 int, index t2f2(f2)); insert into t2 values(0),(1),(2); select f2 from t2 where f2 in ('a',2); @@ -543,8 +543,8 @@ Warning 1292 Truncated incorrect DOUBLE value: 'a' Warning 1292 Truncated incorrect DOUBLE value: 'a' Warning 1292 Truncated incorrect DOUBLE value: 'a' explain select f2 from t2 where f2 in ('a',2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index t2f2 t2f2 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index t2f2 t2f2 5 NULL 3 Using where; Using index select f2 from t2 where f2 in ('a','b'); f2 0 @@ -552,8 +552,8 @@ Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'a' Warning 1292 Truncated incorrect DOUBLE value: 'b' explain select f2 from t2 where f2 in ('a','b'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range t2f2 t2f2 5 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range t2f2 t2f2 5 NULL 1 Using where; Using index Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'a' Warning 1292 Truncated incorrect DOUBLE value: 'b' @@ -565,8 +565,8 @@ Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'b' Warning 1292 Truncated incorrect DOUBLE value: 'b' explain select f2 from t2 where f2 in (1,'b'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index t2f2 t2f2 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index t2f2 t2f2 5 NULL 3 Using where; Using index drop table t1, t2; create table t1 (a time, key(a)); insert into t1 values (),(),(),(),(),(),(),(),(),(); @@ -633,125 +633,125 @@ INSERT IGNORE INTO t1 (c_int) VALUES (1), (2), (3), (4), (5); INSERT IGNORE INTO t1 (c_int) SELECT 0 FROM t1; INSERT IGNORE INTO t1 (c_int) SELECT 0 FROM t1; EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_int c_int 4 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_int c_int 4 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, 1, 2, 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_int c_int 4 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_int c_int 4 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_int c_int 4 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_int c_int 4 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, NULL, 2, NULL, 3, NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_int c_int 4 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_int c_int 4 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (1, 2, 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_decimal c_decimal 3 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_decimal c_decimal 3 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, 1, 2, 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_decimal c_decimal 3 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_decimal c_decimal 3 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_float IN (1, 2, 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_float c_float 4 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_float c_float 4 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, 1, 2, 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_float c_float 4 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_float c_float 4 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_bit IN (1, 2, 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_bit c_bit 2 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_bit c_bit 2 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, 1, 2, 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_bit c_bit 2 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_bit c_bit 2 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_date IN ('2009-09-01', '2009-09-02', '2009-09-03'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_date c_date 3 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_date c_date 3 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL, '2009-09-01', '2009-09-02', '2009-09-03'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_date c_date 3 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_date c_date 3 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL, NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_datetime IN ('2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_datetime c_datetime 5 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_datetime c_datetime 5 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL, '2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_datetime c_datetime 5 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_datetime c_datetime 5 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL, NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN ('2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_timestamp c_timestamp 4 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_timestamp c_timestamp 4 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL, '2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_timestamp c_timestamp 4 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_timestamp c_timestamp 4 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL, NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_year IN (1, 2, 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_year c_year 1 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_year c_year 1 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, 1, 2, 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_year c_year 1 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_year c_year 1 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_char IN ('1', '2', '3'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_char c_char 10 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_char c_char 10 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, '1', '2', '3'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c_char c_char 10 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c_char c_char 10 NULL 3 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t1; # # Bug#54477: Crash on IN / CASE with NULL arguments @@ -839,20 +839,20 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2); # Ok to propagate equalities into the left IN argument in case of a single comparison type EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND a IN (1,2,3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 # Ok to propagate equalities into IN () list, even if multiple comparison types EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND 1 IN (1,a,'3'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 # Not Ok to propagate equalities into the left IN argument in case of multiple comparison types EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND a IN (1,2,'3'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and `test`.`t1`.`a` in (1,2,'3') DROP TABLE t1; diff --git a/mysql-test/main/func_isnull.result b/mysql-test/main/func_isnull.result index 8cbd528f2de..fa6fe68a0ed 100644 --- a/mysql-test/main/func_isnull.result +++ b/mysql-test/main/func_isnull.result @@ -41,8 +41,8 @@ d1 0000-00-00 00:00:00 0000-00-00 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE d1 IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`d1` AS `d1` from `test`.`t1` where `test`.`t1`.`d1` = 0 SELECT count(*) FROM t1 WHERE d1 IS NULL; @@ -59,8 +59,8 @@ d1 0000-00-00 00:00:00 0000-00-00 00:00:00 EXPLAIN EXTENDED SELECT * FROM v1 WHERE d1 IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`d1` AS `d1` from `test`.`t1` where `test`.`t1`.`d1` = 0 SELECT count(*) FROM v1 WHERE d1 IS NULL; @@ -86,9 +86,9 @@ d1 d1 1980-09-03 20:49:36 NULL EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON t2.d1=t1.d1 WHERE t1.d1 IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`d1` AS `d1`,`test`.`t1`.`d1` AS `d1` from `test`.`t2` left join `test`.`t1` on(`test`.`t1`.`d1` = `test`.`t2`.`d1`) where `test`.`t1`.`d1` = 0 or `test`.`t1`.`d1` is null SELECT * FROM t2 LEFT JOIN v1 ON t2.d1=v1.d1 WHERE v1.d1 IS NULL; @@ -98,9 +98,9 @@ d1 d1 1980-09-03 20:49:36 NULL EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN v1 ON t2.d1=v1.d1 WHERE v1.d1 IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`d1` AS `d1`,`test`.`t1`.`d1` AS `d1` from `test`.`t2` left join (`test`.`t1`) on(`test`.`t1`.`d1` = `test`.`t2`.`d1`) where `test`.`t1`.`d1` = 0 or `test`.`t1`.`d1` is null DROP VIEW v1; @@ -114,13 +114,13 @@ CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM; CREATE VIEW v1 AS SELECT * FROM t1; INSERT INTO t1 VALUES (1); EXPLAIN EXTENDED SELECT ISNULL(pk) FROM v1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select /*always not null*/ 1 is null AS `ISNULL(pk)` from dual EXPLAIN EXTENDED SELECT IFNULL(pk,0) FROM v1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select ifnull(1,0) AS `IFNULL(pk,0)` from dual DROP VIEW v1; diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index f9845357d51..2c654ea5e93 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -1375,9 +1375,9 @@ drop table t1; CREATE TABLE t1 (e INT, a VARCHAR(255), v VARCHAR(255)); INSERT INTO t1 VALUES (0, 'a1', '1') , (0, 'a2', '2') , (1, 'b1', '3'); EXPLAIN SELECT B.e, JSON_OBJECTAGG(B.a, B.v) FROM t1 A, t1 B GROUP BY B.e, B.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A ALL NULL NULL NULL NULL 3 Using temporary; Using filesort -1 SIMPLE B ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 Using temporary; Using filesort +1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) SELECT B.e, JSON_OBJECTAGG(B.a, B.v) FROM t1 A, t1 B GROUP BY B.e, B.a; e JSON_OBJECTAGG(B.a, B.v) 0 {"a1":"1", "a1":"1", "a1":"1"} diff --git a/mysql-test/main/func_like.result b/mysql-test/main/func_like.result index 200cb20c4de..a5d986a0da5 100644 --- a/mysql-test/main/func_like.result +++ b/mysql-test/main/func_like.result @@ -2,13 +2,13 @@ drop table if exists t1; create table t1 (a varchar(10), key(a)); insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); explain extended select * from t1 where a like 'abc%'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 13 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 13 NULL 2 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` like 'abc%' explain extended select * from t1 where a like concat('abc','%'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 13 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 13 NULL 2 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` like <cache>(concat('abc','%')) select * from t1 where a like "abc%"; @@ -221,8 +221,8 @@ SELECT * FROM t1 WHERE a=10.0 AND a LIKE 10.00; a 10.00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10.0 AND a LIKE 10.00; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 10.0 and `test`.`t1`.`a` like 10.00 DROP TABLE t1; @@ -239,11 +239,11 @@ INSERT INTO t1 VALUES ('00:00:05'); INSERT INTO t1 VALUES ('00:00:06'); INSERT INTO t1 VALUES ('00:00:07'); EXPLAIN SELECT * FROM t1 WHERE a LIKE '00:00:00'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 13 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 13 NULL 1 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a LIKE TIME'00:00:00'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 13 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 13 NULL 1 Using where; Using index SELECT * FROM t1 WHERE a LIKE '00:00:00'; a 00:00:00 @@ -418,8 +418,8 @@ SELECT * FROM v1; 1 1 0 1 1 1 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 EXPLAIN EXTENDED SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using filesort Warnings: Note 1003 select 1 like `test`.`t1`.`c1` | `test`.`t1`.`c2` AS `1 LIKE c1|c2`,1 like `test`.`t1`.`c1` & `test`.`t1`.`c2` AS `1 LIKE c1&c2`,1 like `test`.`t1`.`c2` >> `test`.`t1`.`c1` AS `1 LIKE c2>>c1`,2 like `test`.`t1`.`c2` << `test`.`t1`.`c1` AS `2 LIKE c2<<c1`,1 like `test`.`t1`.`c1` or `test`.`t1`.`c2` <> 0 AS `1 LIKE c1||c2`,2 like `test`.`t1`.`c1` + `test`.`t1`.`c2` AS `2 LIKE c1+c2`,-1 like `test`.`t1`.`c1` - `test`.`t1`.`c2` AS `-1 LIKE c1-c2`,2 like `test`.`t1`.`c1` * `test`.`t1`.`c2` AS `2 LIKE c1*c2`,0.5000 like `test`.`t1`.`c1` / `test`.`t1`.`c2` AS `0.5000 LIKE c1/c2`,0 like `test`.`t1`.`c1` DIV `test`.`t1`.`c2` AS `0 LIKE c1 DIV c2`,0 like `test`.`t1`.`c1` MOD `test`.`t1`.`c2` AS `0 LIKE c1 MOD c2` from `test`.`t1` order by `test`.`t1`.`c2` DROP VIEW v1; diff --git a/mysql-test/main/func_math.result b/mysql-test/main/func_math.result index bebd7cd9655..e48d6e526ec 100644 --- a/mysql-test/main/func_math.result +++ b/mysql-test/main/func_math.result @@ -3,32 +3,32 @@ select floor(5.5),floor(-5.5); floor(5.5) floor(-5.5) 5 -6 explain extended select floor(5.5),floor(-5.5); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select floor(5.5) AS `floor(5.5)`,floor(-5.5) AS `floor(-5.5)` select ceiling(5.5),ceiling(-5.5); ceiling(5.5) ceiling(-5.5) 6 -5 explain extended select ceiling(5.5),ceiling(-5.5); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select ceiling(5.5) AS `ceiling(5.5)`,ceiling(-5.5) AS `ceiling(-5.5)` select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1); truncate(52.64,1) truncate(52.64,2) truncate(52.64,-1) truncate(52.64,-2) truncate(-52.64,1) truncate(-52.64,-1) 52.6 52.64 50 0 -52.6 -50 explain extended select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-1) AS `truncate(52.64,-1)`,truncate(52.64,-2) AS `truncate(52.64,-2)`,truncate(-52.64,1) AS `truncate(-52.64,1)`,truncate(-52.64,-1) AS `truncate(-52.64,-1)` select round(5.5),round(-5.5); round(5.5) round(-5.5) 6 -6 explain extended select round(5.5),round(-5.5); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select round(5.5,0) AS `round(5.5)`,round(-5.5,0) AS `round(-5.5)` select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2); @@ -38,8 +38,8 @@ select abs(-10), sign(-5), sign(5), sign(0); abs(-10) sign(-5) sign(5) sign(0) 10 -1 1 0 explain extended select abs(-10), sign(-5), sign(5), sign(0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select abs(-10) AS `abs(-10)`,sign(-5) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)` select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2); @@ -50,8 +50,8 @@ Warning 1365 Division by 0 Warning 1365 Division by 0 Warning 1365 Division by 0 explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select log(exp(10)) AS `log(exp(10))`,exp(log(sqrt(10)) * 2) AS `exp(log(sqrt(10))*2)`,log(-1) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-1,2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)` select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL); @@ -61,8 +61,8 @@ Warnings: Warning 1365 Division by 0 Warning 1365 Division by 0 explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select ln(exp(10)) AS `ln(exp(10))`,exp(ln(sqrt(10)) * 2) AS `exp(ln(sqrt(10))*2)`,ln(-1) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)` select log2(8),log2(15),log2(-2),log2(0),log2(NULL); @@ -72,8 +72,8 @@ Warnings: Warning 1365 Division by 0 Warning 1365 Division by 0 explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-2) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)` select log10(100),log10(18),log10(-4),log10(0),log10(NULL); @@ -83,16 +83,16 @@ Warnings: Warning 1365 Division by 0 Warning 1365 Division by 0 explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-4) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)` select pow(10,log10(10)),power(2,4); pow(10,log10(10)) power(2,4) 10 16 explain extended select pow(10,log10(10)),power(2,4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4)` set @@rand_seed1=10000000,@@rand_seed2=1000000; @@ -100,16 +100,16 @@ select rand(999999),rand(); rand(999999) rand() 0.014231365187309091 0.028870999839968048 explain extended select rand(999999),rand(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select rand(999999) AS `rand(999999)`,rand() AS `rand()` select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6); pi() format(sin(pi()/2),6) format(cos(pi()/2),6) format(abs(tan(pi())),6) format(cot(1),6) format(asin(1),6) format(acos(0),6) format(atan(1),6) 3.141593 1.000000 0.000000 0.000000 0.642093 1.570796 1.570796 0.785398 explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select pi() AS `pi()`,format(sin(pi() / 2),6) AS `format(sin(pi()/2),6)`,format(cos(pi() / 2),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format(cot(1),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)` select degrees(pi()),radians(360); @@ -149,8 +149,8 @@ select format(4.55, 1), format(4.551, 1); format(4.55, 1) format(4.551, 1) 4.6 4.6 explain extended select degrees(pi()),radians(360); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)` select rand(rand); diff --git a/mysql-test/main/func_misc.result b/mysql-test/main/func_misc.result index 7597da95f3d..98b4f5895d7 100644 --- a/mysql-test/main/func_misc.result +++ b/mysql-test/main/func_misc.result @@ -30,8 +30,8 @@ select sys_guid() != sys_guid(); sys_guid() != sys_guid() 1 explain extended select uuid() = "", sys_guid() = ""; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select uuid() = '' AS `uuid() = ""`,sys_guid() = '' AS `sys_guid() = ""` set @a= uuid_short(); @@ -301,8 +301,8 @@ CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,10); CREATE VIEW v1 AS SELECT * FROM t1; EXPLAIN EXTENDED SELECT VALUE(b) FROM v1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select value(10) AS `VALUE(b)` from dual drop view v1; @@ -363,18 +363,18 @@ CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv; CREATE ALGORITHM=MERGE VIEW vm AS SELECT * FROM tv; explain extended select a from t1 left join v_merge on (a=e) where last_value(NULL,e) not in (select last_value(NULL,e) from vm); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY tv ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY tv system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY tv NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY tv NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on(`test`.`tv`.`e` = `test`.`t1`.`a`) where !<expr_cache><last_value(NULL,`test`.`tv`.`e`)>(<in_optimizer>(last_value(NULL,`test`.`tv`.`e`),<exists>(/* select#2 */ select last_value(NULL,'1') from dual where trigcond(<cache>(last_value(NULL,`test`.`tv`.`e`)) = last_value(NULL,'1'))))) explain extended select a from t1 left join v_merge on (a=e) where e not in (select last_value(NULL,e) from vm); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY tv ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY tv system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY tv NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY tv NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on(`test`.`tv`.`e` = `test`.`t1`.`a`) where !<expr_cache><`test`.`tv`.`e`>(<in_optimizer>(`test`.`tv`.`e`,<exists>(/* select#2 */ select last_value(NULL,'1') from dual where trigcond(<cache>(`test`.`tv`.`e`) = last_value(NULL,'1'))))) set optimizer_switch=@optimizer_switch_save; diff --git a/mysql-test/main/func_op.result b/mysql-test/main/func_op.result index 36fe8446638..0cea03e7fc0 100644 --- a/mysql-test/main/func_op.result +++ b/mysql-test/main/func_op.result @@ -2,16 +2,16 @@ select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2; 1+1 1-1 1+1*2 8/5 8%5 mod(8,5) mod(8,5)|0 -(1+1)*-2 2 0 3 1.6000 3 3 3 4 explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 1 + 1 AS `1+1`,1 - 1 AS `1-1`,1 + 1 * 2 AS `1+1*2`,8 / 5 AS `8/5`,8 MOD 5 AS `8%5`,8 MOD 5 AS `mod(8,5)`,8 MOD 5 | 0 AS `mod(8,5)|0`,-(1 + 1) * -2 AS `-(1+1)*-2` select 1 | (1+1),5 & 3,bit_count(7) ; 1 | (1+1) 5 & 3 bit_count(7) 3 1 3 explain extended select 1 | (1+1),5 & 3,bit_count(7) ; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 1 | 1 + 1 AS `1 | (1+1)`,5 & 3 AS `5 & 3`,bit_count(7) AS `bit_count(7)` select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60; diff --git a/mysql-test/main/func_regexp.result b/mysql-test/main/func_regexp.result index 187df785f69..e9b9513df81 100644 --- a/mysql-test/main/func_regexp.result +++ b/mysql-test/main/func_regexp.result @@ -49,8 +49,8 @@ select * from t1 where xxx regexp('is a test of some long text to'); xxx this is a test of some long text to see what happens explain extended select * from t1 where xxx regexp('is a test of some long text to'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select 'this is a test of some long text to see what happens' AS `xxx` from dual where 1 select * from t1 where xxx regexp('is a test of some long text to '); diff --git a/mysql-test/main/func_regexp_pcre.result b/mysql-test/main/func_regexp_pcre.result index 4544a1df71c..4de058caa30 100644 --- a/mysql-test/main/func_regexp_pcre.result +++ b/mysql-test/main/func_regexp_pcre.result @@ -440,8 +440,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; EXPLAIN EXTENDED SELECT REGEXP_REPLACE('abc','b','x'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select regexp_replace('abc','b','x') AS `REGEXP_REPLACE('abc','b','x')` SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR @@ -743,8 +743,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; EXPLAIN EXTENDED SELECT REGEXP_SUBSTR('abc','b'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select regexp_substr('abc','b') AS `REGEXP_SUBSTR('abc','b')` SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR diff --git a/mysql-test/main/func_set.result b/mysql-test/main/func_set.result index 3bd9f5e0c9a..ad78f68d6d4 100644 --- a/mysql-test/main/func_set.result +++ b/mysql-test/main/func_set.result @@ -2,8 +2,8 @@ select interval(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),fie interval(55,10,20,30,40,50,60,70,80,90,100) interval(3,1,1+1,1+1+1+1) field("IBM","NCA","ICL","SUN","IBM","DIGITAL") field("A","B","C") elt(2,"ONE","TWO","THREE") interval(0,1,2,3,4) elt(1,1,2,3)|0 elt(1,1.1,1.2,1.3)+0 5 2 4 0 TWO 0 1 1.1 explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select interval(55,10,20,30,40,50,60,70,80,90,100) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval(3,1,1 + 1,1 + 1 + 1 + 1) AS `interval(3,1,1+1,1+1+1+1)`,field('IBM','NCA','ICL','SUN','IBM','DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field('A','B','C') AS `field("A","B","C")`,elt(2,'ONE','TWO','THREE') AS `elt(2,"ONE","TWO","THREE")`,interval(0,1,2,3,4) AS `interval(0,1,2,3,4)`,elt(1,1,2,3) | 0 AS `elt(1,1,2,3)|0`,elt(1,1.1,1.2,1.3) + 0 AS `elt(1,1.1,1.2,1.3)+0` SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56); diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index 799fd1933dd..ae48f11d465 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -839,238 +839,238 @@ select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),substring_index("1abcd substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2) substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2) 1abcd;2abcd 3abcd;4abcd explain extended select md5('hello'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select md5('hello') AS `md5('hello')` explain extended select sha('abc'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select sha('abc') AS `sha('abc')` explain extended select sha1('abc'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select sha('abc') AS `sha1('abc')` explain extended select soundex(''); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select soundex('') AS `soundex('')` explain extended select 'mood' sounds like 'mud'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select soundex('mood') = soundex('mud') AS `'mood' sounds like 'mud'` explain extended select aes_decrypt(aes_encrypt('abc','1'),'1'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select aes_decrypt(aes_encrypt('abc','1'),'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')` explain extended select concat('*',space(5),'*'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select concat('*',space(5),'*') AS `concat('*',space(5),'*')` explain extended select reverse('abc'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select reverse('abc') AS `reverse('abc')` explain extended select rpad('a',4,'1'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select rpad('a',4,'1') AS `rpad('a',4,'1')` explain extended select lpad('a',4,'1'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select lpad('a',4,'1') AS `lpad('a',4,'1')` explain extended select rpad('a',4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select rpad('a',4) AS `rpad('a',4)` explain extended select lpad('a',4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select lpad('a',4) AS `lpad('a',4)` explain extended select concat_ws(',','',NULL,'a'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select concat_ws(',','',NULL,'a') AS `concat_ws(',','',NULL,'a')` explain extended select make_set(255,_latin2'a', _latin2'b', _latin2'c'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a', _latin2'b', _latin2'c')` explain extended select elt(2,1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select elt(2,1) AS `elt(2,1)` explain extended select locate("a","b",2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select locate('a','b',2) AS `locate("a","b",2)` explain extended select format(130,10); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select format(130,10) AS `format(130,10)` explain extended select char(0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select char(0) AS `char(0)` explain extended select conv(130,16,10); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select conv(130,16,10) AS `conv(130,16,10)` explain extended select hex(130); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select hex(130) AS `hex(130)` explain extended select binary 'HE'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select cast('HE' as char charset binary) AS `binary 'HE'` explain extended select export_set(255,_latin2'y', _latin2'n', _latin2' '); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y', _latin2'n', _latin2' ')` explain extended select FIELD('b' COLLATE latin1_bin,'A','B'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select field('b' collate latin1_bin,'A','B') AS `FIELD('b' COLLATE latin1_bin,'A','B')` explain extended select FIND_IN_SET(_latin1'B', _latin1'a,b,c,d'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B', _latin1'a,b,c,d')` explain extended select collation(conv(130,16,10)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select collation(conv(130,16,10)) AS `collation(conv(130,16,10))` explain extended select coercibility(conv(130,16,10)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))` explain extended select length('\n\t\r\b\0\_\%\\'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select octet_length('\n \r\0008\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')` explain extended select bit_length('\n\t\r\b\0\_\%\\'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select bit_length('\n \r\0008\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')` explain extended select bit_length('\n\t\r\b\0\_\%\\'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select bit_length('\n \r\0008\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')` explain extended select concat('monty',' was here ','again'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select concat('monty',' was here ','again') AS `concat('monty',' was here ','again')` explain extended select length('hello'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select octet_length('hello') AS `length('hello')` explain extended select char(ascii('h')); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select char(ascii('h')) AS `char(ascii('h'))` explain extended select ord('h'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select ord('h') AS `ord('h')` explain extended select quote(1/0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select quote(1 / 0) AS `quote(1/0)` explain extended select crc32("123"); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select crc32('123') AS `crc32("123")` explain extended select replace('aaaa','a','b'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select replace('aaaa','a','b') AS `replace('aaaa','a','b')` explain extended select insert('txs',2,1,'hi'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select insert('txs',2,1,'hi') AS `insert('txs',2,1,'hi')` explain extended select left(_latin2'a',1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select left(_latin2'a',1) AS `left(_latin2'a',1)` explain extended select right(_latin2'a',1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select right(_latin2'a',1) AS `right(_latin2'a',1)` explain extended select lcase(_latin2'a'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select lcase(_latin2'a') AS `lcase(_latin2'a')` explain extended select ucase(_latin2'a'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select ucase(_latin2'a') AS `ucase(_latin2'a')` explain extended select SUBSTR('abcdefg',3,2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select substr('abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)` explain extended select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select substring_index('1abcd;2abcd;3abcd;4abcd',';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)` explain extended select trim(_latin2' a '); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select trim(_latin2' a ') AS `trim(_latin2' a ')` explain extended select ltrim(_latin2' a '); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select ltrim(_latin2' a ') AS `ltrim(_latin2' a ')` explain extended select rtrim(_latin2' a '); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select rtrim(_latin2' a ') AS `rtrim(_latin2' a ')` explain extended select decode(encode(repeat("a",100000),"monty"),"monty"); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select decode(encode(repeat('a',100000),'monty'),'monty') AS `decode(encode(repeat("a",100000),"monty"),"monty")` SELECT lpad(12345, 5, "#"); @@ -1145,14 +1145,14 @@ EXPLAIN SELECT id FROM t1 WHERE a = 16307858876001849059; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 EXPLAIN SELECT id FROM t1 WHERE a = CONV('e251273eb74a8ee3', 16, 10); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 DROP TABLE t1; SELECT CHAR(NULL,121,83,81,'76') as my_column; my_column @@ -1318,40 +1318,40 @@ DROP TABLE t1; CREATE TABLE t1 (s varchar(10)); INSERT INTO t1 VALUES ('yadda'), ('yaddy'); EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(`test`.`t1`.`s`) > 'ab' EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(both 'y' from `test`.`t1`.`s`) > 'ab' EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(leading 'y' from `test`.`t1`.`s`) > 'ab' EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(trailing 'y' from `test`.`t1`.`s`) > 'ab' EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(both 'y' from `test`.`t1`.`s`) > 'ab' DROP TABLE t1; create table t1(f1 varchar(4)); explain extended select encode(f1,'zxcv') as 'enc' from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select encode(NULL,'zxcv') AS `enc` from `test`.`t1` explain extended select decode(f1,'zxcv') as 'enc' from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select decode(NULL,'zxcv') AS `enc` from `test`.`t1` drop table t1; @@ -1427,9 +1427,9 @@ A12 a12 EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON code=id WHERE id='a12' AND (LENGTH(code)=5 OR code < 'a00'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 const PRIMARY PRIMARY 12 const 1 100.00 Using index -1 SIMPLE t1 ref code code 13 const 4 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 12 const 1 100.00 Using index +1 SIMPLE t1 NULL ref code code 13 const 4 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`code` = 'a12' and octet_length(`test`.`t1`.`code`) = 5 DROP TABLE t1,t2; @@ -2748,15 +2748,15 @@ insert into t1 values (-1),(null); set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; explain select 1 as a from t1,(select decode(f1,f1) as b from t1) a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 explain select 1 as a from t1,(select encode(f1,f1) as b from t1) a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 set optimizer_switch=@tmp_optimizer_switch; drop table t1; # @@ -4817,18 +4817,18 @@ set global max_allowed_packet=@save_max_allowed_packet; # MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1) # EXPLAIN EXTENDED SELECT CHAR(0xDF USING latin1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select char(0xdf using latin1) AS `CHAR(0xDF USING latin1)` EXPLAIN EXTENDED SELECT CHAR(0xDF USING `binary`); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select char(0xdf) AS `CHAR(0xDF USING ``binary``)` EXPLAIN EXTENDED SELECT CHAR(0xDF); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select char(0xdf) AS `CHAR(0xDF)` # @@ -4887,8 +4887,8 @@ a 18446744073709551615 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,709,551,615'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 18446744073709551615 and format(`test`.`t1`.`a`,0) = '18,446,744,073,709,551,615' DROP TABLE t1; @@ -5120,8 +5120,8 @@ SELECT LENGTHB('a'), LENGTHB(_utf8 0xC39F), LENGTHB(123), LENGTH(null); LENGTHB('a') LENGTHB(_utf8 0xC39F) LENGTHB(123) LENGTH(null) 1 2 3 NULL EXPLAIN EXTENDED SELECT LENGTH('a'), LENGTHB('a'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select octet_length('a') AS `LENGTH('a')`,octet_length('a') AS `LENGTHB('a')` # diff --git a/mysql-test/main/func_system.result b/mysql-test/main/func_system.result index e435fc61986..8b44faf72b3 100644 --- a/mysql-test/main/func_system.result +++ b/mysql-test/main/func_system.result @@ -38,8 +38,8 @@ select charset(version()); charset(version()) utf8mb3 explain extended select database(), user(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select database() AS `database()`,user() AS `user()` create table t1 (version char(60)) select database(), user(), version() as 'version'; diff --git a/mysql-test/main/func_test.result b/mysql-test/main/func_test.result index 04aee8b5522..5653496b9b6 100644 --- a/mysql-test/main/func_test.result +++ b/mysql-test/main/func_test.result @@ -45,8 +45,8 @@ select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1; 3 ^ 11 1 ^ 1 1 ^ 0 1 ^ NULL NULL ^ 1 8 0 1 NULL NULL explain extended select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 3 ^ 11 AS `3 ^ 11`,1 ^ 1 AS `1 ^ 1`,1 ^ 0 AS `1 ^ 0`,1 ^ NULL AS `1 ^ NULL`,NULL ^ 1 AS `NULL ^ 1` select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL; @@ -59,16 +59,16 @@ select 10 % 7, 10 mod 7, 10 div 3; 10 % 7 10 mod 7 10 div 3 3 3 3 explain extended select 10 % 7, 10 mod 7, 10 div 3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 10 MOD 7 AS `10 % 7`,10 MOD 7 AS `10 mod 7`,10 DIV 3 AS `10 div 3` select 18446744073709551615, 18446744073709551615 DIV 1, 18446744073709551615 DIV 2; 18446744073709551615 18446744073709551615 DIV 1 18446744073709551615 DIV 2 18446744073709551615 18446744073709551615 9223372036854775807 explain extended select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select (1 << 64) - 1 AS `(1 << 64)-1`,((1 << 64) - 1) DIV 1 AS `((1 << 64)-1) DIV 1`,((1 << 64) - 1) DIV 2 AS `((1 << 64)-1) DIV 2` create table t1 (a int); @@ -76,16 +76,16 @@ insert t1 values (1); select * from t1 where 1 xor 1; a explain extended select * from t1 where 1 xor 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 select - a from t1; - a -1 explain extended select - a from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select -1 AS `- a` from dual drop table t1; @@ -96,8 +96,8 @@ select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci; _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci 1 explain extended select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select _koi8r'a' = _koi8r'A' collate koi8r_general_ci AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci` select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin; @@ -285,16 +285,16 @@ not a 1 NULL explain extended select not a from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 Warnings: Note 1003 select `test`.`t1`.`a` = 0 AS `not a` from `test`.`t1` select * from t1 where not a; a 0 explain extended select * from t1 where not a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0 select not (a+0) from t1; @@ -304,16 +304,16 @@ not (a+0) 1 NULL explain extended select not (a+0) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 Warnings: Note 1003 select !(`test`.`t1`.`a` + 0) AS `not (a+0)` from `test`.`t1` select * from t1 where not (a+0); a 0 explain extended select * from t1 where not (a+0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where !(`test`.`t1`.`a` + 0) select not 1, not null, not not null, 1 is not null; @@ -330,8 +330,8 @@ SELECT NOT NOT strcmp('a','b'); NOT NOT strcmp('a','b') 1 EXPLAIN EXTENDED SELECT NOT NOT strcmp('a','b'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select strcmp('a','b') <> 0 AS `NOT NOT strcmp('a','b')` # diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result index 7bca4158d70..0a40e8ced69 100644 --- a/mysql-test/main/func_time.result +++ b/mysql-test/main/func_time.result @@ -875,8 +875,8 @@ select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0; strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0 1 explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_days(to_days("960101")),dayofmonth("1997-01-02"), month("1997-01-02"), monthname("1972-03-04"),dayofyear("0000-00-00"),HOUR("1997-03-03 23:03:22"),MINUTE("23:03:22"),SECOND(230322),QUARTER(980303),WEEK("1998-03-03"),yearweek("2000-01-01",1),week(19950101,1),year("98-02-03"),weekday(curdate())-weekday(now()),dayname("1962-03-03"),unix_timestamp(),sec_to_time(time_to_sec("0:30:47")/6.21),curtime(),utc_time(),curdate(),utc_date(),utc_timestamp(),date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"),from_unixtime(unix_timestamp("1994-03-02 10:11:12")),"1997-12-31 23:59:59" + INTERVAL 1 SECOND,"1998-01-01 00:00:00" - INTERVAL 1 SECOND,INTERVAL 1 DAY + "1997-12-31", extract(YEAR FROM "1999-01-02 10:11:12"),date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select period_add('9602',-12) AS `period_add("9602",-12)`,period_diff(199505,'9404') AS `period_diff(199505,"9404")`,from_days(to_days('960101')) AS `from_days(to_days("960101"))`,dayofmonth('1997-01-02') AS `dayofmonth("1997-01-02")`,month('1997-01-02') AS `month("1997-01-02")`,monthname('1972-03-04') AS `monthname("1972-03-04")`,dayofyear('0000-00-00') AS `dayofyear("0000-00-00")`,hour('1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute('23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week('1998-03-03') AS `WEEK("1998-03-03")`,yearweek('2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year('98-02-03') AS `year("98-02-03")`,weekday(curdate()) - weekday(current_timestamp()) AS `weekday(curdate())-weekday(now())`,dayname('1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time(time_to_sec('0:30:47') / 6.21) AS `sec_to_time(time_to_sec(" 0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format('1997-01-02 03:04:05','%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp('1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,'1997-12-31 23:59:59' + interval 1 second AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,'1998-01-01 00:00:00' - interval 1 second AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,'1997-12-31' + interval 1 day AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from '1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,'1997-12-31 23:59:59' + interval 1 second AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)` SET @TMP='2007-08-01 12:22:49'; @@ -3499,13 +3499,13 @@ select * from v3; default(pk) 1 explain extended select * from v3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select default(`test`.`t2`.`pk`) AS `default(pk)` from dual explain extended select default(pk) from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select default(`test`.`t2`.`pk`) AS `default(pk)` from dual show create view v3; @@ -3770,16 +3770,16 @@ c1 c2 c3 EXPLAIN EXTENDED SELECT TIMESTAMP'2001-01-01 10:20:30' - INTERVAL '10' YEAR AS c1, -INTERVAL '10' YEAR + TIMESTAMP'2001-01-01 10:20:30' AS c2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select TIMESTAMP'2001-01-01 10:20:30' - interval '10' year AS `c1`,TIMESTAMP'2001-01-01 10:20:30' - interval '10' year AS `c2` EXPLAIN EXTENDED SELECT TIMESTAMP'2001-01-01 10:20:30' + INTERVAL '10' YEAR AS c1, INTERVAL '10' YEAR + TIMESTAMP'2001-01-01 10:20:30' AS c2, +INTERVAL '10' YEAR + TIMESTAMP'2001-01-01 10:20:30' AS c3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select TIMESTAMP'2001-01-01 10:20:30' + interval '10' year AS `c1`,TIMESTAMP'2001-01-01 10:20:30' + interval '10' year AS `c2`,TIMESTAMP'2001-01-01 10:20:30' + interval '10' year AS `c3` CREATE TABLE t_ts (a timestamp(6)); @@ -3833,8 +3833,8 @@ a SELECT * FROM t1 WHERE SUBTIME(a,TIME'00:00:01')=TIME'00:00:09' AND ADDTIME(a,TIME'00:00:01')<=TIME'00:00:09'; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE SUBTIME(a,TIME'00:00:01')=TIME'00:00:09' AND ADDTIME(a,TIME'00:00:01')<=TIME'00:00:09'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where subtime(`test`.`t1`.`a`,TIME'00:00:01') = TIME'00:00:09' and addtime(`test`.`t1`.`a`,TIME'00:00:01') <= TIME'00:00:09' DROP TABLE t1; diff --git a/mysql-test/main/func_time_hires.result b/mysql-test/main/func_time_hires.result index a76571a67b5..186e5a6f6ad 100644 --- a/mysql-test/main/func_time_hires.result +++ b/mysql-test/main/func_time_hires.result @@ -153,8 +153,8 @@ t5 12:13:14.12345 t6 12:13:14.123456 drop table t1; explain extended select cast(cast(@a as datetime(4)) as time(0)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select cast(cast(@`a` as datetime(4)) as time) AS `cast(cast(@a as datetime(4)) as time(0))` select cast(cast(@a as time(2)) as time(6)); diff --git a/mysql-test/main/func_weight_string.result b/mysql-test/main/func_weight_string.result index 3b72cdafa32..142f1204fc7 100644 --- a/mysql-test/main/func_weight_string.result +++ b/mysql-test/main/func_weight_string.result @@ -117,8 +117,8 @@ a 000001 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and weight_string(`test`.`t1`.`a`,0,0,1) is null ALTER TABLE t1 MODIFY a DOUBLE ZEROFILL; @@ -127,8 +127,8 @@ a 0000000000000000000001 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and weight_string(`test`.`t1`.`a`,0,0,1) is null ALTER TABLE t1 MODIFY a DECIMAL(10,1) ZEROFILL; @@ -137,8 +137,8 @@ a 000000001.0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 and weight_string(`test`.`t1`.`a`,0,0,1) is null DROP TABLE t1; diff --git a/mysql-test/main/gis-rt-precise.result b/mysql-test/main/gis-rt-precise.result index d3308ed90ba..1f018c9e1d4 100644 --- a/mysql-test/main/gis-rt-precise.result +++ b/mysql-test/main/gis-rt-precise.result @@ -16,8 +16,8 @@ SELECT count(*) FROM t1; count(*) 150 EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 140))')); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range g g 34 NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range g g 34 NULL 8 Using where SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')); fid AsText(g) 1 LINESTRING(150 150,150 150) @@ -50,8 +50,8 @@ count(*) 100 EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((40 40,60 40,60 60,40 40))')); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range g g 34 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range g g 34 NULL 4 Using where SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((40 40,60 40,60 60,40 40))')); fid AsText(g) diff --git a/mysql-test/main/gis-rtree.result b/mysql-test/main/gis-rtree.result index 5f0187eaa30..f2ed437d860 100644 --- a/mysql-test/main/gis-rtree.result +++ b/mysql-test/main/gis-rtree.result @@ -165,8 +165,8 @@ SELECT count(*) FROM t1; count(*) 150 EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range g g 34 NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range g g 34 NULL 8 Using where SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')); fid AsText(g) 1 LINESTRING(150 150,150 150) @@ -299,8 +299,8 @@ count(*) 100 EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g, GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range g g 34 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range g g 34 NULL 4 Using where SELECT fid, AsText(g) FROM t2 WHERE Within(g, GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); fid AsText(g) @@ -1486,32 +1486,32 @@ INSERT INTO t1 VALUES (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')), (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')); EXPLAIN SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'); 1 1 1 EXPLAIN SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'); 1 EXPLAIN SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'); 1 1 1 EXPLAIN SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'); 1 EXPLAIN SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'); 1 1 @@ -1596,17 +1596,17 @@ DROP TABLE t1; CREATE TABLE t1 (a GEOMETRY NOT NULL, SPATIAL KEY(a)); INSERT INTO t1 VALUES (Point(1,2)),(Point(1,3)); EXPLAIN SELECT * FROM t1 WHERE MBRINTERSECTS(a,Point(1,2)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 34 NULL 1 Using where EXPLAIN SELECT * FROM t1 WHERE ST_INTERSECTS(a,Point(1,2)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 34 NULL 1 Using where EXPLAIN SELECT * FROM t1 WHERE MBRINTERSECTS(Point(1,2),a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 34 NULL 1 Using where EXPLAIN SELECT * FROM t1 WHERE ST_INTERSECTS(Point(1,2),a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 34 NULL 1 Using where DROP TABLE t1; # # MDEV-8610 "WHERE CONTAINS(indexed_geometry_column,1)" causes full table scan diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index f941447a677..b0f4db97bbd 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -238,8 +238,8 @@ fid AsText(Envelope(g)) 122 GEOMETRYCOLLECTION EMPTY 123 GEOMETRYCOLLECTION EMPTY explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 23 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_geometry NULL ALL NULL NULL NULL NULL 23 100.00 Warnings: Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry` SELECT fid, X(g) FROM gis_point; @@ -255,8 +255,8 @@ fid Y(g) 103 20 104 20 explain extended select X(g),Y(g) FROM gis_point; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_point NULL ALL NULL NULL NULL NULL 4 100.00 Warnings: Note 1003 select st_x(`test`.`gis_point`.`g`) AS `X(g)`,st_y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point` SELECT fid, AsText(StartPoint(g)) FROM gis_line; @@ -290,8 +290,8 @@ fid IsClosed(g) 106 1 107 0 explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_line NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `GLength(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line` SELECT fid, AsText(Centroid(g)) FROM gis_polygon; @@ -320,8 +320,8 @@ fid AsText(InteriorRingN(g, 1)) 109 LINESTRING(10 10,20 10,20 20,10 20,10 10) 110 NULL explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_polygon NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon` SELECT fid, IsClosed(g) FROM gis_multi_line; @@ -361,8 +361,8 @@ fid NumGeometries(g) 122 0 123 0 explain extended SELECT fid, NumGeometries(g) from gis_multi_point; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point` SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; @@ -393,8 +393,8 @@ fid AsText(GeometryN(g, 1)) 122 NULL 123 NULL explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point` SELECT g1.fid as first, g2.fid as second, @@ -424,9 +424,9 @@ Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE g1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort -1 SIMPLE g2 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE g1 NULL ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort +1 SIMPLE g2 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,st_within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,st_contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,st_equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid` DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; @@ -467,26 +467,26 @@ SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))); AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))) POINT(1 4) explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select st_astext(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))` explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)')))); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select st_astext(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))` SELECT SRID(GeomFromText('LineString(1 1,2 2)',101)); SRID(GeomFromText('LineString(1 1,2 2)',101)) 101 explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select srid(st_geometryfromtext('LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))` explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select st_issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `issimple(Point(3, 6))` create table t1 (a geometry not null); @@ -963,8 +963,8 @@ COUNT(*) 1 EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system p NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL system p NULL NULL NULL 1 SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 @@ -972,22 +972,22 @@ INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(3 4)')); INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(3 4)')); EXPLAIN SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref p p 28 const # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref p p 28 const # Using where SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 EXPLAIN SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 diff --git a/mysql-test/main/grant_explain_non_select.result b/mysql-test/main/grant_explain_non_select.result index 53b7d687d6c..41c2ec83dbd 100644 --- a/mysql-test/main/grant_explain_non_select.result +++ b/mysql-test/main/grant_explain_non_select.result @@ -21,12 +21,12 @@ connection default; GRANT INSERT ON privtest_db.t1 TO 'privtest'@'localhost'; connection con1; EXPLAIN INSERT INTO t1 VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL INSERT INTO t1 VALUES (10); EXPLAIN INSERT INTO t1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 INSERT INTO t1 SELECT * FROM t2; connection default; REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; @@ -66,12 +66,12 @@ connection default; GRANT INSERT, DELETE ON privtest_db.t1 TO 'privtest'@'localhost'; connection con1; EXPLAIN REPLACE INTO t1 VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL REPLACE INTO t1 VALUES (10); EXPLAIN REPLACE INTO t1 SELECT * FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 REPLACE INTO t1 SELECT * FROM t2; connection default; REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; @@ -111,13 +111,13 @@ connection default; GRANT UPDATE, SELECT ON privtest_db.t1 TO 'privtest'@'localhost'; connection con1; EXPLAIN UPDATE t1 SET a = a + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 UPDATE t1 SET a = a + 1; EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; connection default; REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; @@ -158,13 +158,13 @@ REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; GRANT DELETE, SELECT ON privtest_db.t1 TO 'privtest'@'localhost'; connection con1; EXPLAIN DELETE FROM t1 WHERE a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where DELETE FROM t1 WHERE a = 10; EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; connection default; REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost'; diff --git a/mysql-test/main/greedy_optimizer.result b/mysql-test/main/greedy_optimizer.result index d7c7e603c68..d5e37081a15 100644 --- a/mysql-test/main/greedy_optimizer.result +++ b/mysql-test/main/greedy_optimizer.result @@ -117,74 +117,74 @@ select @@optimizer_search_depth; @@optimizer_search_depth 62 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index show status like 'Last_query_cost'; Variable_name Value Last_query_cost 1693.637037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index show status like 'Last_query_cost'; Variable_name Value Last_query_cost 1693.637037 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 @@ -197,74 +197,74 @@ select @@optimizer_search_depth; @@optimizer_search_depth 0 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 1371.437037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 1371.437037 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join) -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 362.618727 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join) -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 362.618727 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 362.618727 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 362.618727 @@ -273,74 +273,74 @@ select @@optimizer_search_depth; @@optimizer_search_depth 1 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index show status like 'Last_query_cost'; Variable_name Value Last_query_cost 1693.637037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index show status like 'Last_query_cost'; Variable_name Value Last_query_cost 1693.637037 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 @@ -349,74 +349,74 @@ select @@optimizer_search_depth; @@optimizer_search_depth 62 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 1371.437037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 1371.437037 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join) -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 362.618727 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join) -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 362.618727 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 362.618727 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using where +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 362.618727 @@ -429,74 +429,74 @@ select @@optimizer_search_depth; @@optimizer_search_depth 0 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index show status like 'Last_query_cost'; Variable_name Value Last_query_cost 1693.637037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index show status like 'Last_query_cost'; Variable_name Value Last_query_cost 1693.637037 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 @@ -505,74 +505,74 @@ select @@optimizer_search_depth; @@optimizer_search_depth 1 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index show status like 'Last_query_cost'; Variable_name Value Last_query_cost 1693.637037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index show status like 'Last_query_cost'; Variable_name Value Last_query_cost 1693.637037 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 @@ -581,74 +581,74 @@ select @@optimizer_search_depth; @@optimizer_search_depth 62 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index show status like 'Last_query_cost'; Variable_name Value Last_query_cost 1693.637037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index show status like 'Last_query_cost'; Variable_name Value Last_query_cost 1693.637037 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) show status like 'Last_query_cost'; Variable_name Value Last_query_cost 844.037037 diff --git a/mysql-test/main/group_by.result b/mysql-test/main/group_by.result index 8c1ba102e8f..e76868e50cf 100644 --- a/mysql-test/main/group_by.result +++ b/mysql-test/main/group_by.result @@ -54,9 +54,9 @@ userid MIN(t1.score+0.0) 2 2.0 1 1.0 EXPLAIN SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid ORDER BY NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where; Using temporary -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.userID 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where; Using temporary +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.userID 1 Using index drop table t1,t2; CREATE TABLE t1 ( PID int(10) unsigned NOT NULL auto_increment, @@ -253,11 +253,11 @@ key (score) ); INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3),(6,3,3),(7,3,3); explain select userid,count(*) from t1 group by userid desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using temporary; Using filesort explain select userid,count(*) from t1 group by userid desc order by null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using temporary select userid,count(*) from t1 group by userid desc; userid count(*) 3 5 @@ -269,14 +269,14 @@ userid count(*) select userid,count(*) from t1 group by userid desc having 3 IN (1,COUNT(*)); userid count(*) explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range spID spID 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range spID spID 5 NULL 3 Using where; Using index explain select spid,count(*) from t1 where spid between 1 and 2 group by spid; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range spID spID 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range spID spID 5 NULL 3 Using where; Using index explain select spid,count(*) from t1 where spid between 1 and 2 group by spid order by null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range spID spID 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range spID spID 5 NULL 3 Using where; Using index select spid,count(*) from t1 where spid between 1 and 2 group by spid; spid count(*) 1 1 @@ -286,13 +286,13 @@ spid count(*) 2 2 1 1 explain extended select sql_big_result spid,sum(userid) from t1 group by spid desc; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using filesort Warnings: Note 1003 select sql_big_result `test`.`t1`.`spID` AS `spid`,sum(`test`.`t1`.`userID`) AS `sum(userid)` from `test`.`t1` group by `test`.`t1`.`spID` desc explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using filesort select sql_big_result spid,sum(userid) from t1 group by spid desc; spid sum(userid) 7 3 @@ -303,11 +303,11 @@ spid sum(userid) 2 3 1 1 explain select sql_big_result score,count(*) from t1 group by score desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL score 3 NULL 8 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL score 3 NULL 8 Using index; Using filesort explain select sql_big_result score,count(*) from t1 group by score desc order by null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL score 3 NULL 8 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL score 3 NULL 8 Using index; Using filesort select sql_big_result score,count(*) from t1 group by score desc; score count(*) 3 5 @@ -551,13 +551,13 @@ a b 2 2 3 1 explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL a NULL NULL NULL 4 Using temporary; Using filesort -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 4 Using temporary; Using filesort +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL a NULL NULL NULL 4 Using temporary -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 4 Using temporary +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) drop table t1,t2; SET @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity,@@optimizer_switch=@save_optimizer_switch; create table t1 (a int, b int); @@ -629,8 +629,8 @@ userid count(*) 2 1 1 2 EXPLAIN SELECT userid,count(*) FROM t1 GROUP BY userid DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using temporary; Using filesort DROP TABLE t1; CREATE TABLE t1 ( i int(11) default NULL, @@ -643,8 +643,8 @@ i COUNT(DISTINCT(i)) 2 1 4 4 explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using filesort DROP TABLE t1; create table t1 (a int); insert into t1 values(null); @@ -721,8 +721,8 @@ concat('val-', @a + 120*D.a) from t1 x3, t1 x4, t1 C, t1 D where x3.a < 3 and x4.a < 4 and D.a < 4; delete from t2 where a = 2 and b = 'val-2' order by a,b,c,d limit 30; explain select c from t2 where a = 2 and b = 'val-2' group by c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref PRIMARY,a PRIMARY 402 const,const 6 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref PRIMARY,a PRIMARY 402 const,const 6 Using where select c from t2 where a = 2 and b = 'val-2' group by c; c val-74 @@ -898,9 +898,9 @@ CREATE VIEW v1 AS select t1.a, concat(t1.b,'') AS b, t1.b as real_b from t1; explain SELECT straight_join sql_no_cache v1.a, v1.b, v1.real_b from t2, v1 where t2.b=v1.a GROUP BY t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b b 2 NULL 10 Using where; Using index -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 1 test.t2.b 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index b b 2 NULL 10 Using where; Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 1 test.t2.b 1 SELECT straight_join sql_no_cache v1.a, v1.b, v1.real_b from t2, v1 where t2.b=v1.a GROUP BY t2.b; a b real_b @@ -926,11 +926,11 @@ SELECT MIN(b), MAX(b) from t1; MIN(b) MAX(b) 0 19 EXPLAIN SELECT b, sum(1) FROM t1 GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 5 NULL 128 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL b 5 NULL 128 Using index EXPLAIN SELECT SQL_BIG_RESULT b, sum(1) FROM t1 GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 5 NULL 128 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL b 5 NULL 128 Using index; Using filesort SELECT b, sum(1) FROM t1 GROUP BY b; b sum(1) 0 6 @@ -1325,8 +1325,8 @@ INSERT INTO t1 VALUES (9,6,6, 't','t'), (10,0,0,'c','c'); explain SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar'; X drop table t1; @@ -1345,27 +1345,27 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT a FROM t1 WHERE a < 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,i2 PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,i2 PRIMARY 4 NULL 1 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a < 2 ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,i2 PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,i2 PRIMARY 4 NULL 1 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a < 2 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,i2 PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,i2 PRIMARY 4 NULL 1 Using where; Using index EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY,i2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR JOIN (PRIMARY,i2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 # # For this explain, the query plan is weird: if we are using # the primary key for reasons other than doing grouping, can't # GROUP BY code take advantage of this? Well, currently it doesnt: EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 144 Using index; Using filesort # Here's a proof it is really doing sorting: flush status; SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a; @@ -1382,8 +1382,8 @@ Sort_scan 1 # the primary key for reasons other than doing sorting, can't # ORDER BY code take advantage of this? Well, currently it doesnt: EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 144 Using index; Using filesort # Here's a proof it is really doing sorting: flush status; SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a; @@ -1544,20 +1544,20 @@ a 144 EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY) IGNORE INDEX FOR GROUP BY (i2) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 144 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 144 Using index EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY) IGNORE INDEX FOR ORDER BY (i2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL i2 9 NULL 144 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL i2 9 NULL 144 Using index EXPLAIN SELECT a FROM t1 FORCE INDEX (i2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL i2 9 NULL 144 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL i2 9 NULL 144 Using index EXPLAIN SELECT a FROM t1 USE INDEX (); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 EXPLAIN SELECT a FROM t1 USE INDEX () USE INDEX (i2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 EXPLAIN SELECT a FROM t1 FORCE INDEX (PRIMARY) IGNORE INDEX FOR GROUP BY (i2) @@ -1565,63 +1565,63 @@ IGNORE INDEX FOR ORDER BY (i2) USE INDEX (i2); ERROR HY000: Incorrect usage of USE INDEX and FORCE INDEX EXPLAIN SELECT a FROM t1 USE INDEX (i2) USE INDEX (); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL i2 9 NULL 144 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL i2 9 NULL 144 Using index EXPLAIN SELECT a FROM t1 FORCE INDEX (); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1 EXPLAIN SELECT a FROM t1 IGNORE INDEX (); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1 EXPLAIN SELECT a FROM t1 USE INDEX FOR JOIN (i2) USE INDEX FOR GROUP BY (i2) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 # NULL i2 # NULL # # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL # NULL i2 # NULL # # EXPLAIN SELECT a FROM t1 FORCE INDEX FOR JOIN (i2) FORCE INDEX FOR GROUP BY (i2) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL i2 4 NULL 145 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL i2 4 NULL 145 Using index for group-by EXPLAIN SELECT a FROM t1 USE INDEX () IGNORE INDEX (i2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 EXPLAIN SELECT a FROM t1 IGNORE INDEX (i2) USE INDEX (); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 EXPLAIN SELECT a FROM t1 USE INDEX FOR GROUP BY (i2) USE INDEX FOR ORDER BY (i2) USE INDEX FOR JOIN (i2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL i2 9 NULL 144 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL i2 9 NULL 144 Using index EXPLAIN SELECT a FROM t1 USE INDEX FOR JOIN (i2) USE INDEX FOR JOIN (i2) USE INDEX FOR JOIN (i2,i2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL i2 9 NULL 144 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL i2 9 NULL 144 Using index SET @save_optimizer_switch=@@optimizer_switch; SET optimizer_switch='semijoin_with_cache=off'; EXPLAIN SELECT 1 FROM t1 WHERE a IN (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index PRIMARY,i2 PRIMARY 4 NULL 144 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index PRIMARY,i2 PRIMARY 4 NULL 144 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 144 SET optimizer_switch=@save_optimizer_switch; CREATE TABLE t2 (a INT, b INT, KEY(a)); INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4); EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 5 NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 5 NULL 2 EXPLAIN SELECT a, SUM(b) FROM t2 IGNORE INDEX (a) GROUP BY a LIMIT 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 Using temporary; Using filesort SET @save_optimizer_switch=@@optimizer_switch; SET optimizer_switch='semijoin_with_cache=off'; EXPLAIN SELECT 1 FROM t2 WHERE a IN (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index a a 5 NULL 4 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 144 SET optimizer_switch=@save_optimizer_switch; DROP TABLE t1, t2; CREATE TABLE t1( @@ -1639,48 +1639,48 @@ UNIQUE KEY(a,b) ); INSERT INTO t2 VALUES (NULL, NULL), (NULL, NULL), (NULL, 1), (1, NULL), (1, 1), (1,2); EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using filesort SELECT c,b,d FROM t1 GROUP BY c,b,d; c b d 1 1 50 3 1 4 3 2 40 EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL; c b d 1 1 50 3 2 40 3 1 4 EXPLAIN SELECT c,b,d FROM t1 ORDER BY c,b,d; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using filesort SELECT c,b,d FROM t1 ORDER BY c,b,d; c b d 1 1 50 3 1 4 3 2 40 EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using filesort SELECT c,b,d FROM t1 GROUP BY c,b; c b d 1 1 50 3 1 4 3 2 40 EXPLAIN SELECT c,b FROM t1 GROUP BY c,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL c 8 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL c 8 NULL 3 Using index SELECT c,b FROM t1 GROUP BY c,b; c b 1 1 3 1 3 2 EXPLAIN SELECT a,b from t2 ORDER BY a,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 10 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 10 NULL 6 Using index SELECT a,b from t2 ORDER BY a,b; a b NULL NULL @@ -1690,8 +1690,8 @@ NULL 1 1 1 1 2 EXPLAIN SELECT a,b from t2 GROUP BY a,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 10 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 10 NULL 6 Using index SELECT a,b from t2 GROUP BY a,b; a b NULL NULL @@ -1700,15 +1700,15 @@ NULL 1 1 1 1 2 EXPLAIN SELECT a from t2 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL a 5 NULL 7 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL a 5 NULL 7 Using index for group-by SELECT a from t2 GROUP BY a; a NULL 1 EXPLAIN SELECT b from t2 GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 10 NULL 6 Using index; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 10 NULL 6 Using index; Using temporary; Using filesort SELECT b from t2 GROUP BY b; b NULL @@ -1798,17 +1798,17 @@ aa COUNT(DISTINCT b) # execution plan should not use temporary table: EXPLAIN EXTENDED SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY aa+0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using filesort -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using filesort +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select <expr_cache><`test`.`t1`.`a`>((/* select#2 */ select `test`.`t1`.`a`)) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by <expr_cache><`test`.`t1`.`a`>((/* select#2 */ select `test`.`t1`.`a`)) + 0 EXPLAIN EXTENDED SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY -aa; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using filesort -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using filesort +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select <expr_cache><`test`.`t1`.`a`>((/* select#2 */ select `test`.`t1`.`a`)) AS `aa`,count(distinct `test`.`t1`.`b`) AS `COUNT(DISTINCT b)` from `test`.`t1` group by -<expr_cache><`test`.`t1`.`a`>((/* select#2 */ select `test`.`t1`.`a`)) @@ -1858,14 +1858,14 @@ CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t2 (a INT PRIMARY KEY); INSERT INTO t2 VALUES (1), (2); EXPLAIN SELECT MIN(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT MIN(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a; MIN(t2.a) 1 EXPLAIN SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a; MAX(t2.a) 2 @@ -1897,6 +1897,7 @@ SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a; id 1 select_type SIMPLE table t1 +partitions NULL type ALL possible_keys NULL key NULL @@ -1912,6 +1913,7 @@ SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a; id 1 select_type SIMPLE table t1 +partitions NULL type ALL possible_keys NULL key NULL @@ -1957,10 +1959,10 @@ SELECT a, AVG(t1.b), (SELECT t11.c FROM t1 t11 WHERE t11.a = t1.a AND t11.b = AVG(t1.b)) AS t11c, (SELECT t12.c FROM t1 t12 WHERE t12.a = t1.a AND t12.b = AVG(t1.b)) AS t12c FROM t1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 10 NULL 9 Using index -3 DEPENDENT SUBQUERY t12 ref a a 10 func,func 2 Using index condition -2 DEPENDENT SUBQUERY t11 ref a a 10 func,func 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 10 NULL 9 Using index +3 DEPENDENT SUBQUERY t12 NULL ref a a 10 func,func 2 Using index condition +2 DEPENDENT SUBQUERY t11 NULL ref a a 10 func,func 2 Using index condition SELECT a, AVG(t1.b), (SELECT t11.c FROM t1 t11 WHERE t11.a = t1.a AND t11.b = AVG(t1.b)) AS t11c, (SELECT t12.c FROM t1 t12 WHERE t12.a = t1.a AND t12.b = AVG(t1.b)) AS t12c @@ -2013,8 +2015,8 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10), (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); EXPLAIN SELECT col1 AS field1, col1 AS field2 FROM t1 GROUP BY field1, field2;; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx 5 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 Using index FLUSH STATUS; SELECT col1 AS field1, col1 AS field2 FROM t1 GROUP BY field1, field2;; @@ -2044,8 +2046,8 @@ Variable_name Value Sort_scan 0 EXPLAIN SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2 FROM t1 GROUP BY field1, field2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 Using index; Using filesort FLUSH STATUS; SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2 FROM t1 GROUP BY field1, field2; @@ -2108,12 +2110,12 @@ field1 field2 1 3 explain select col1 f1, col1 f2 from t1 order by f2, f1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx 5 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 Using index explain select col1 f1, col1 f2 from t1 order by f2, f1+0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 Using index; Using filesort select col1 f1, col1 f2 from t1 order by f2, f1+0; f1 f2 1 1 @@ -2138,8 +2140,8 @@ f1 f2 20 20 explain select col1 f1, col1 f2 from t1 group by f1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx 5 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 Using index select col1 f1, col1 f2 from t1 group by f1; f1 f2 1 1 @@ -2164,8 +2166,8 @@ f1 f2 20 20 explain select col1 f1, col1 f2 from t1 group by f1, f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx 5 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 Using index select col1 f1, col1 f2 from t1 group by f1, f2; f1 f2 1 1 @@ -2190,8 +2192,8 @@ f1 f2 20 20 explain select col1 f1, col1 f2 from t1 group by f2 order by f2, f1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx 5 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 Using index select col1 f1, col1 f2 from t1 group by f2 order by f2, f1; f1 f2 1 1 @@ -2216,8 +2218,8 @@ f1 f2 20 20 explain select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx 5 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 Using index select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1; f1 f2 1 1 @@ -2249,24 +2251,24 @@ INSERT INTO t2(col1, col2) VALUES (11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1); explain select col1 f1, col2 f2, col1 f3 from t2 group by f1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx 5 NULL 7 Using index for group-by explain select SQL_BIG_RESULT col1 f1, col2 f2, col1 f3 from t2 group by f1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx 5 NULL 7 Using index for group-by explain select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL idx 10 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL idx 10 NULL 20 Using index explain select col1 f1, col1 f2 from t2 group by f1, 1+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx 5 NULL 7 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx 5 NULL 7 Using index for group-by explain select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3+0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL idx 10 NULL 20 Using index; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL idx 10 NULL 20 Using index; Using temporary; Using filesort select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3+0; f1 f2 f3 1 20 1 @@ -2291,12 +2293,12 @@ f1 f2 f3 20 1 20 explain select col1 f1, col2 f2, col1 f3 from t2 order by f1,f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL idx 10 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL idx 10 NULL 20 Using index explain select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL idx 10 NULL 20 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL idx 10 NULL 20 Using index; Using filesort select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0; f1 f2 f3 1 20 1 @@ -2418,17 +2420,17 @@ CREATE TABLE t2 (col1 int, col2 int) ; INSERT INTO t2 VALUES (10,8); EXPLAIN SELECT SQL_BUFFER_RESULT t2.col2 FROM t2 JOIN t1 ON t1.col1 GROUP BY t2.col2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 Using temporary -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 Using temporary +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT SQL_BUFFER_RESULT t2.col2 FROM t2 JOIN t1 ON t1.col1 GROUP BY t2.col2; col2 8 EXPLAIN SELECT t2.col2 FROM t2 JOIN t1 ON t1.col1 GROUP BY t2.col2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t2.col2 FROM t2 JOIN t1 ON t1.col1 GROUP BY t2.col2; col2 8 @@ -2451,16 +2453,16 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT SQL_BUFFER_RESULT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range b b 9 NULL 2 Using where; Using index for group-by; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range b b 9 NULL 2 Using where; Using index for group-by; Using temporary SELECT SQL_BUFFER_RESULT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b; MIN(a) b 0 a EXPLAIN SELECT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range b b 9 NULL 2 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range b b 9 NULL 2 Using where; Using index for group-by SELECT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b; MIN(a) b @@ -2528,9 +2530,9 @@ set join_cache_level=0; EXPLAIN SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 GROUP BY t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx idx 5 NULL 5 Using where; Using index -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 5 Using where; Using index +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 Using index SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 GROUP BY t2.a; a @@ -2544,9 +2546,9 @@ set optimizer_switch='outer_join_with_cache=off'; EXPLAIN SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 GROUP BY t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx idx 5 NULL 5 Using where; Using index -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 5 Using where; Using index +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 Using where; Using index SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 GROUP BY t2.a; a @@ -2783,9 +2785,9 @@ select max(a)+ (select col1 from t2 where t2.c=t1.c) from t1 group by t1.b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 101 Using temporary; Using filesort -2 DEPENDENT SUBQUERY t2 ref c c 5 func 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 101 Using temporary; Using filesort +2 DEPENDENT SUBQUERY t2 NULL ref c c 5 func 1 select max(a) + (select col1 from t2 where t2.c=t1.c) from t1 @@ -2880,8 +2882,8 @@ CREATE TABLE t1 ( pk int, i1 int, v1 varchar(1)); explain SELECT 1 FROM t1 GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING SELECT 1 FROM t1 GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ; 1 diff --git a/mysql-test/main/group_by.test b/mysql-test/main/group_by.test index 97209b50cda..8ce1732bdb2 100644 --- a/mysql-test/main/group_by.test +++ b/mysql-test/main/group_by.test @@ -1057,7 +1057,7 @@ EXPLAIN SELECT a FROM t1 IGNORE INDEX (); # without support for large files the rowid is shorter and its size affects # the cost calculations. This causes the optimizer to choose loose index # scan over normal index access. ---replace_column 4 # 7 # 9 # 10 # +--replace_column 5 # 8 # 10 # 11 # EXPLAIN SELECT a FROM t1 USE INDEX FOR JOIN (i2) USE INDEX FOR GROUP BY (i2) GROUP BY a; EXPLAIN SELECT a FROM t1 FORCE INDEX FOR JOIN (i2) diff --git a/mysql-test/main/group_by_innodb.result b/mysql-test/main/group_by_innodb.result index f935d4da45b..39890618838 100644 --- a/mysql-test/main/group_by_innodb.result +++ b/mysql-test/main/group_by_innodb.result @@ -14,8 +14,8 @@ EXPLAIN SELECT COUNT(*), pk field1, pk AS field2 FROM t1 WHERE a = 'r' OR pk = 183 GROUP BY field1, field2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY,pk PRIMARY 4 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY,pk PRIMARY 4 NULL 2 Using where SELECT COUNT(*), pk field1, pk AS field2 FROM t1 WHERE a = 'r' OR pk = 183 GROUP BY field1, field2; @@ -23,8 +23,8 @@ COUNT(*) field1 field2 EXPLAIN SELECT COUNT(*), pk field1 FROM t1 WHERE a = 'r' OR pk = 183 GROUP BY field1, field1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY,pk PRIMARY 4 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY,pk PRIMARY 4 NULL 2 Using where SELECT COUNT(*), pk field1 FROM t1 WHERE a = 'r' OR pk = 183 GROUP BY field1, field1; COUNT(*) field1 @@ -154,8 +154,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT DISTINCT a, MAX(b) FROM t1 WHERE a >= 0 GROUP BY a,a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx3 idx3 5 NULL 100 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1,idx3 idx3 5 NULL 100 Using where; Using index SELECT DISTINCT a, MAX(b) FROM t1 WHERE a >= 0 GROUP BY a,a; a MAX(b) 1 10 diff --git a/mysql-test/main/group_min_max.result b/mysql-test/main/group_min_max.result index 0f75103240d..e9bbf0c4c20 100644 --- a/mysql-test/main/group_min_max.result +++ b/mysql-test/main/group_min_max.result @@ -137,35 +137,35 @@ Table Op Msg_type Msg_text test.t3 analyze status Engine-independent statistics collected test.t3 analyze status Table is already up to date explain select a1, min(a2) from t1 group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 130 NULL 5 Using index for group-by explain select a1, max(a2) from t1 group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 65 NULL 5 Using index for group-by explain select a1, min(a2), max(a2) from t1 group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 130 NULL 5 Using index for group-by explain select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using index for group-by explain select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using index for group-by explain select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 # NULL # Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 # NULL # Using index for group-by explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 130 NULL 5 Using index for group-by explain select a1, b, min(c), a1, max(c), b, a2, max(c), max(c) from t1 group by a1, a2, b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using index for group-by explain select min(a2) from t1 group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 130 NULL 5 Using index for group-by explain select a2, min(c), max(c) from t1 group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using index for group-by select a1, min(a2) from t1 group by a1; a1 min(a2) a a @@ -291,74 +291,74 @@ a e412 h412 b i421 l421 b m422 p422 explain select a1,a2,b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 12 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 12 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by explain select a1,a2,b, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by explain select a1, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'c' or a2 < 'b' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by explain select a1,a2,b, max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 9 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 9 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 9 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 9 Using where; Using index for group-by explain select a1,a2,b, max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 9 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 9 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 9 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 9 Using where; Using index for group-by explain select a1,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by explain select a1, max(c) from t1 where a1 in ('a','b','d') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by explain select a1,a2,b, max(c) from t2 where a1 < 'd' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where a1 < 'd' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by explain select a1, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where a1 >= 'c' or a2 < 'b' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b, max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b, max(c) from t2 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1, max(c) from t2 where a1 in ('a','b','d') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by select a1,a2,b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b; a1 a2 b min(c) max(c) a a a a111 d111 @@ -673,41 +673,41 @@ d h412 d l421 d p422 explain select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 5 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 5 Using where; Using index for group-by explain select a1,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 5 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 5 Using where; Using index for group-by explain select a1,a2,b, max(c) from t1 where (b = 'b') group by a1,a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 9 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where (b = 'b') group by a1,a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 9 Using where; Using index for group-by explain select a1,a2, max(c) from t1 where (b = 'b') group by a1,a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 9 Using where; Using index for group-by explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL 6 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL 6 Using where; Using index for group-by explain select a1,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL 6 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL 6 Using where; Using index for group-by explain select a1,a2,b, max(c) from t2 where (b = 'b') group by a1,a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where (b = 'b') group by a1,a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by explain select a1,a2, max(c) from t2 where (b = 'b') group by a1,a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by explain select a1,a2,b,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range NULL idx_t3_1 6 NULL 4 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL range NULL idx_t3_1 6 NULL 4 Using where; Using index for group-by explain select a1,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range NULL idx_t3_1 6 NULL 4 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL range NULL idx_t3_1 6 NULL 4 Using where; Using index for group-by select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1; a1 a2 b max(c) min(c) a a b h112 e112 @@ -808,23 +808,23 @@ a h112 e112 b h212 e212 c h312 e312 explain select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL 6 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL 6 Using where; Using index for group-by explain select a1,a2,b,max(c) from t2 where (a2 = 'a') and b is NULL group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 146 NULL 6 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL 6 Using where; Using index for group-by explain select a1,a2,b,min(c) from t2 where b is NULL group by a1,a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by explain select a1,a2,b,max(c) from t2 where b is NULL group by a1,a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1; a1 a2 b min(c) a a NULL a777 @@ -850,98 +850,98 @@ a1 a2 b min(c) max(c) a a NULL a777 a999 c a NULL c777 c999 explain select a1,a2,b, max(c) from t1 where (c > 'b1') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b, max(c) from t1 where (c > 'f123') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where (c > 'f123') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b, max(c) from t1 where (c < 'a0') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b, max(c) from t1 where (c < 'k321') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where (c < 'k321') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b, max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where (c between 'b111' and 'g112') or (c between 'd000' and 'i110') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b, max(c) from t2 where (c > 'b1') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b, max(c) from t2 where (c > 'f123') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where (c > 'f123') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b, max(c) from t2 where (c < 'a0') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b, max(c) from t2 where (c < 'k321') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where (c < 'k321') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b, max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b, max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b111') and (c <= 'g112') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by select a1,a2,b, max(c) from t1 where (c > 'b1') group by a1,a2,b; a1 a2 b max(c) a a a d111 @@ -1362,10 +1362,10 @@ d a b e412 h412 explain select a1,a2,b,min(c),max(c) from t1 where exists ( select * from t2 where t2.c = t1.c ) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL idx_t1_1 163 NULL 512 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 func 1 -2 MATERIALIZED t2 index NULL idx_t2_1 163 NULL 548 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 512 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 16 func 1 +2 MATERIALIZED t2 NULL index NULL idx_t2_1 163 NULL 548 Using index select a1,a2,b,min(c),max(c) from t1 where exists ( select * from t2 where t2.c = t1.c ) group by a1,a2,b; @@ -1389,9 +1389,9 @@ d b b m422 p422 explain select a1,a2,b,min(c),max(c) from t1 where exists ( select * from t2 where t2.c > 'b1' ) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL idx_t1_1 163 NULL 512 Using index -2 SUBQUERY t2 index NULL idx_t2_1 163 NULL 548 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 512 Using index +2 SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 548 Using where; Using index select a1,a2,b,min(c),max(c) from t1 where exists ( select * from t2 where t2.c > 'b1' ) group by a1,a2,b; @@ -1415,9 +1415,9 @@ d b b m422 p422 explain select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 where t1.b > 'a' and t2.c > 'b1' ) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL idx_t1_1 163 NULL 512 Using where; Using index -2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 548 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 512 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 548 Using where; Using index select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 where t1.b > 'a' and t2.c > 'b1' ) group by a1,a2,b; @@ -1437,10 +1437,10 @@ where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.b) and t2.c > 'b1' ) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL idx_t1_1 163 NULL 512 Using where; Using index -2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 548 Using where; Using index -2 DEPENDENT SUBQUERY t3 index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 512 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 548 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2) select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.b) and @@ -1467,9 +1467,9 @@ SET optimizer_switch=@save_optimizer_switch; explain select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 where t1.c > 'a' and t2.c > 'b1' ) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL idx_t1_1 163 NULL 512 Using where; Using index -2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 548 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 512 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 548 Using where; Using index select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 where t1.c > 'a' and t2.c > 'b1' ) group by a1,a2,b; @@ -1497,10 +1497,10 @@ where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.c) and t2.c > 'b1' ) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL idx_t1_1 163 NULL 512 Using where; Using index -2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 548 Using where; Using index -2 DEPENDENT SUBQUERY t3 index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 512 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 548 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2) select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.c) and @@ -1525,44 +1525,44 @@ d b a i421 i421 l421 d b b m422 m422 o422 SET optimizer_switch=@save_optimizer_switch; explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t1 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 13 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 13 Using where; Using index for group-by explain select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 13 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 13 Using where; Using index for group-by explain select a1,a2,b,min(c) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by explain select a1,a2,b,min(c) from t1 where (ord(a1) > 97) and (ord(a2) + ord(a1) > 194) and (b = 'c') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c),max(c) from t2 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c) from t2 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c) from t2 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b,min(c) from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b; a1 a2 b min(c) max(c) a a b e112 h112 @@ -1648,29 +1648,29 @@ d b a k421 select a1,a2,b,min(c) from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; a1 a2 b min(c) explain select a1,a2,b from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by explain select a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by explain select a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by explain select a1,a2,b from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by explain select a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # Using where; Using index for group-by explain select a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by select a1,a2,b from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b; a1 a2 b a a b @@ -1711,39 +1711,39 @@ a b a i121 select a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; a1 a2 b explain select distinct a1,a2,b from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using index for group-by explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 65 100.00 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 65 100.00 Using where; Using index for group-by Warnings: Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`b` = 'a' and `test`.`t1`.`c` = 'i121' and `test`.`t1`.`a2` >= 'b' explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by explain select distinct b from t1 where (a2 >= 'b') and (b = 'a'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx_t1_2 147 NULL 512 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL idx_t1_2 147 NULL 512 Using where; Using index explain select distinct a1,a2,b from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # Using index for group-by explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # Using where; Using index for group-by explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL 69 100.00 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL 69 100.00 Using where; Using index for group-by Warnings: Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`b` = 'a' and `test`.`t2`.`c` = 'i121' and `test`.`t2`.`a2` >= 'b' explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by explain select distinct b from t2 where (a2 >= 'b') and (b = 'a'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL idx_t2_2 146 NULL 548 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL idx_t2_2 146 NULL 548 Using where; Using index select distinct a1,a2,b from t1; a1 a2 b a a a @@ -1859,35 +1859,35 @@ b e c e d e explain select distinct a1,a2,b from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using index for group-by explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by explain select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 Using where; Using index for group-by explain select distinct b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by; Using temporary; Using filesort explain select distinct a1,a2,b from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # Using index for group-by explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # Using where; Using index for group-by explain select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by explain select distinct b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # Using where; Using index for group-by; Using temporary; Using filesort select distinct a1,a2,b from t1; a1 a2 b a a a @@ -1957,22 +1957,22 @@ select distinct b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b; b a explain select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by explain select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 163 NULL 65 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 163 NULL 65 Using where; Using index for group-by explain extended select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 100.00 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 100.00 Using where; Using index for group-by Warnings: Note 1003 select count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `count(distinct a1,a2,b)` from `test`.`t1` where `test`.`t1`.`b` = 'c' and `test`.`t1`.`a1` > 'a' and `test`.`t1`.`a2` > 'a' explain select count(distinct b) from t1 where (a2 >= 'b') and (b = 'a'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx_t1_2 147 NULL 512 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL idx_t1_2 147 NULL 512 Using where; Using index explain extended select 98 + count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 100.00 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 13 100.00 Using where; Using index for group-by Warnings: Note 1003 select 98 + count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `98 + count(distinct a1,a2,b)` from `test`.`t1` where `test`.`t1`.`a1` > 'a' and `test`.`t1`.`a2` > 'a' select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a'); @@ -1991,20 +1991,20 @@ select 98 + count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a'); 98 + count(distinct a1,a2,b) 104 explain select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 12 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 12 Using where; Using index for group-by explain select concat(a1,min(c)),b from t1 where a1 < 'd' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 12 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 12 Using where; Using index for group-by explain select concat(a1,min(c)),b,max(c) from t1 where a1 < 'd' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 12 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 12 Using where; Using index for group-by explain select concat(a1,a2),b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 12 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 12 Using where; Using index for group-by explain select concat(ord(min(b)),ord(max(b))),min(b),max(b) from t1 group by a1,a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 9 Using index for group-by select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b; a1 a2 b concat(min(c), max(c)) a a a a111d111 @@ -2072,64 +2072,64 @@ concat(ord(min(b)),ord(max(b))) min(b) max(b) 9798 a b 9798 a b explain select a1,a2,b,d,min(c),max(c) from t1 group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 512 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 512 Using temporary; Using filesort explain select a1,a2,b,d from t1 group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 512 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 512 Using temporary; Using filesort explain extended select a1,a2,min(b),max(b) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 276 96.30 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 276 96.30 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`c` > 'a111' group by `test`.`t1`.`a1`,`test`.`t1`.`a2` explain extended select a1,a2,b,min(c),max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 512 26.37 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 512 26.37 Using where; Using temporary; Using filesort Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`d` > 'xy2' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` explain extended select a1,a2,b,c from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b,c; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 512 26.37 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 512 26.37 Using where; Using temporary; Using filesort Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`d` > 'xy2' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c` explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b < 'b') group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL idx_t2_1 163 NULL 548 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL idx_t2_1 163 NULL 548 Using where; Using index explain extended select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 276 96.30 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 276 96.30 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`c` > 'a111' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` explain select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL idx_t2_1 163 NULL 548 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL idx_t2_1 163 NULL 548 Using where; Using index select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1; a1 a2 min(b) c a a a a111 explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b = 'a') group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL idx_t2_1 163 NULL 548 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL idx_t2_1 163 NULL 548 Using where; Using index explain select a1,a2,b,min(c),max(c) from t2 where (c > 'a000') and (c <= 'd999') and (c like '_8__') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL idx_t2_1 163 NULL 548 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL idx_t2_1 163 NULL 548 Using where; Using index explain select a1, a2, b, c, min(d), max(d) from t1 group by a1,a2,b,c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 512 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 512 Using temporary; Using filesort explain select a1,a2,count(a2) from t1 group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx_t1_2 147 NULL 512 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL idx_t1_2 147 NULL 512 Using index explain extended select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 392 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 392 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,count(`test`.`t1`.`a2`) AS `count(a2)` from `test`.`t1` where `test`.`t1`.`a1` > 'a' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` explain extended select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 392 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 65 NULL 392 100.00 Using where; Using index Warnings: Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where `test`.`t1`.`a1` > 'a' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` create table t4 as select distinct a1, a2, b, c from t1; @@ -2137,8 +2137,8 @@ alter table t4 add unique index idxt4 (a1, a2, b, c); # This is "superceded" by MDEV-7118, and Loose Index Scan is again an option: explain select a1, a2, b, min(c) from t4 group by a1, a2, b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 range NULL idxt4 147 NULL 10 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL range NULL idxt4 147 NULL 10 Using index for group-by select a1, a2, b, min(c) from t4 group by a1, a2, b; a1 a2 b min(c) a a a a111 @@ -2159,8 +2159,8 @@ d b a i421 d b b m422 drop table t4; explain select distinct(a1) from t1 where ord(a2) = 98; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL idx_t1_2 147 NULL 512 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL idx_t1_2 147 NULL 512 Using where; Using index select distinct(a1) from t1 where ord(a2) = 98; a1 a @@ -2168,8 +2168,8 @@ b c d explain select a1 from t1 where a2 = 'b' group by a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 130 NULL 5 Using where; Using index for group-by select a1 from t1 where a2 = 'b' group by a1; a1 a @@ -2177,8 +2177,8 @@ b c d explain select distinct a1 from t1 where a2 = 'b'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 130 NULL 5 Using where; Using index for group-by select distinct a1 from t1 where a2 = 'b'; a1 a @@ -2229,11 +2229,11 @@ SELECT a FROM t1 WHERE a='BB' GROUP BY a; a BB EXPLAIN SELECT a FROM t1 WHERE a='AA' GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref PRIMARY PRIMARY 7 const 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 7 const 4 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref PRIMARY PRIMARY 7 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 7 const 1 Using where; Using index SELECT DISTINCT a FROM t1 WHERE a='BB'; a BB @@ -2294,8 +2294,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT DISTINCT a,a FROM t1 ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 66 NULL 12 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 66 NULL 12 Using index for group-by SELECT DISTINCT a,a FROM t1 ORDER BY a; a a @@ -2362,8 +2362,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain SELECT MAX(b), a FROM t1 WHERE b < 2 AND a = 1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a,b a 10 NULL 2 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a,b a 10 NULL 2 Using where; Using index for group-by SELECT MAX(b), a FROM t1 WHERE b < 2 AND a = 1 GROUP BY a; MAX(b) a 1 1 @@ -2373,8 +2373,8 @@ MIN(b) a CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a,b,c)); INSERT INTO t2 SELECT a,b,b FROM t1; explain SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY PRIMARY 12 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 12 NULL 1 Using where; Using index SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a; MIN(c) 2 @@ -2387,8 +2387,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT max(b), a FROM t1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 5 NULL 6 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 5 NULL 6 Using index for group-by FLUSH STATUS; SELECT max(b), a FROM t1 GROUP BY a; max(b) a @@ -2402,8 +2402,8 @@ Handler_read_key 8 Handler_read_next 0 Handler_read_retry 0 EXPLAIN SELECT max(b), a FROM t1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 5 NULL 6 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 5 NULL 6 Using index for group-by FLUSH STATUS; CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a; SHOW STATUS LIKE 'handler_read__e%'; @@ -2438,49 +2438,49 @@ Handler_read_next 0 Handler_read_retry 0 EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION (SELECT max(b), a FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range NULL a 5 NULL 6 Using index for group-by -2 UNION t1 range NULL a 5 NULL 6 Using index for group-by -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range NULL a 5 NULL 6 Using index for group-by +2 UNION t1 NULL range NULL a 5 NULL 6 Using index for group-by +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL EXPLAIN SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x FROM t1 AS t1_outer; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index -2 SUBQUERY t1 range a a 5 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer NULL index NULL a 10 NULL 15 Using index +2 SUBQUERY t1 NULL range a a 5 NULL 5 Using where; Using index EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index -2 SUBQUERY t1 index NULL a 10 NULL 15 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer NULL index NULL a 10 NULL 15 Using index +2 SUBQUERY t1 NULL index NULL a 10 NULL 15 Using index EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range a a 5 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL range a a 5 NULL 5 Using where; Using index EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_outer index a a 10 NULL 15 Using where; Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1_outer.a 1 -2 MATERIALIZED t1 range a a 5 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer NULL index a a 10 NULL 15 Using where; Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t1_outer.a 1 +2 MATERIALIZED t1 NULL range a a 5 NULL 5 Using where; Using index EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_outer range NULL a 5 NULL 6 Using index for group-by -2 SUBQUERY t1 range a a 5 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer NULL range NULL a 5 NULL 6 Using index for group-by +2 SUBQUERY t1 NULL range a a 5 NULL 5 Using where; Using index EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2 ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) AND t1_outer1.b = t1_outer2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_outer1 ref a a 5 const 1 Using where; Using index -1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index; Using join buffer (flat, BNL join) -2 SUBQUERY t1 range a a 5 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer1 NULL ref a a 5 const 1 Using where; Using index +1 PRIMARY t1_outer2 NULL index NULL a 10 NULL 15 Using where; Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL range a a 5 NULL 5 Using where; Using index EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using index -2 SUBQUERY t1_outer index NULL a 10 NULL 15 Using index -3 SUBQUERY t1 range a a 5 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer2 NULL index NULL a 10 NULL 15 Using index +2 SUBQUERY t1_outer NULL index NULL a 10 NULL 15 Using index +3 SUBQUERY t1 NULL range a a 5 NULL 5 Using where; Using index CREATE TABLE t3 LIKE t1; FLUSH STATUS; INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a; @@ -2524,16 +2524,16 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT DISTINCT(a) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx 5 NULL 4 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx 5 NULL 4 Using index for group-by SELECT DISTINCT(a) FROM t1; a 1 2 4 EXPLAIN SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx 5 NULL 4 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL idx 5 NULL 4 Using index for group-by SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1; a 1 @@ -2550,8 +2550,8 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using temporary; Using filesort SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC; a MIN(b) MAX(b) 4 1 5 @@ -2561,8 +2561,8 @@ a MIN(b) MAX(b) CREATE INDEX break_it ON t1 (a, b); EXPLAIN SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL break_it 10 NULL 7 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL break_it 10 NULL 7 Using index for group-by SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a; a MIN(b) MAX(b) 1 1 5 @@ -2571,8 +2571,8 @@ a MIN(b) MAX(b) 4 1 5 EXPLAIN SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL break_it 10 NULL 7 Using index for group-by; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL break_it 10 NULL 7 Using index for group-by; Using temporary; Using filesort SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC; a MIN(b) MAX(b) 4 1 5 @@ -2581,8 +2581,8 @@ a MIN(b) MAX(b) 1 1 5 EXPLAIN SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL break_it 10 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL break_it 10 NULL 20 Using index SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC; a MIN(b) MAX(b) AVG(b) 4 1 5 3.0000 @@ -2663,8 +2663,8 @@ a b 3 12 3 13 explain extended select sql_buffer_result a, max(b)+1 from t1 where a = 0 group by a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a,index a 5 NULL 3 100.00 Using where; Using index for group-by; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a,index a 5 NULL 3 100.00 Using where; Using index for group-by; Using temporary Warnings: Note 1003 select sql_buffer_result `test`.`t1`.`a` AS `a`,max(`test`.`t1`.`b`) + 1 AS `max(b)+1` from `test`.`t1` where `test`.`t1`.`a` = 0 group by `test`.`t1`.`a` drop table t1; @@ -2679,8 +2679,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT DISTINCT c FROM t1 WHERE d=4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL foo 10 NULL 3 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL foo 10 NULL 3 Using where; Using index for group-by SELECT DISTINCT c FROM t1 WHERE d=4; c 1 @@ -2702,8 +2702,8 @@ test.t analyze status OK #should use range with index for group by EXPLAIN SELECT a, MIN(b) FROM t WHERE b <> 0 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t range NULL a 10 NULL 2 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t NULL range NULL a 10 NULL 2 Using where; Using index for group-by #should return 1 row SELECT a, MIN(b) FROM t WHERE b <> 0 GROUP BY a; a MIN(b) @@ -2712,8 +2712,8 @@ a MIN(b) #should use range with index for group by EXPLAIN SELECT a, MAX(b) FROM t WHERE b <> 1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t range NULL a 10 NULL 2 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t NULL range NULL a 10 NULL 2 Using where; Using index for group-by #should return 1 row SELECT a, MAX(b) FROM t WHERE b <> 1 GROUP BY a; a MAX(b) @@ -2723,8 +2723,8 @@ INSERT INTO t SELECT a, 2 FROM t; #should use range with index for group by EXPLAIN SELECT a, MAX(b) FROM t WHERE b > 0 AND b < 2 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t range NULL a 10 NULL 2 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t NULL range NULL a 10 NULL 2 Using where; Using index for group-by #should return 1 row SELECT a, MAX(b) FROM t WHERE b > 0 AND b < 2 GROUP BY a; a MAX(b) @@ -2776,144 +2776,144 @@ CREATE TABLE t1 ( a INT, KEY (a) ); INSERT INTO t1 VALUES (1), (2), (3); EXPLAIN SELECT MIN( a ) FROM t1 WHERE a = NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a = NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a <> NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a <> NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a > NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a > NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a < NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a < NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a <=> NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x No matching min/max row SELECT MIN( a ) FROM t1 WHERE a <=> NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0); -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables -x x x x x x x x x Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables +x x x x x x x x x x Using where; Using index SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0); MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x No matching min/max row SELECT MIN( a ) FROM t1 WHERE a IS NULL; MIN( a ) NULL INSERT INTO t1 VALUES (NULL), (NULL); EXPLAIN SELECT MIN( a ) FROM t1 WHERE a = NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a = NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a <> NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a <> NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a > NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a > NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a < NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a < NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a <=> NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Select tables optimized away SELECT MIN( a ) FROM t1 WHERE a <=> NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0); -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables -x x x x x x x x x Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables +x x x x x x x x x x Using where; Using index SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0); MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Select tables optimized away SELECT MIN( a ) FROM t1 WHERE a IS NULL; MIN( a ) NULL @@ -2934,65 +2934,65 @@ INSERT INTO t1 VALUES (1), (2), (3); # EXPLAIN SELECT MIN( a ) FROM t1 WHERE a = NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a = NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a <> NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Using where; Using index SELECT MIN( a ) FROM t1 WHERE a <> NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a > NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a > NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a < NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a < NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND 10; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a BETWEEN NULL AND NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables SELECT MIN( a ) FROM t1 WHERE a BETWEEN 10 AND NULL; MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0); -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE noticed after reading const tables -x x x x x x x x x Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE noticed after reading const tables +x x x x x x x x x x Using where; Using index SELECT MIN( a ) FROM t1 WHERE a = (SELECT a FROM t1 WHERE a < 0); MIN( a ) NULL EXPLAIN SELECT MIN( a ) FROM t1 WHERE a IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -x x x x x x x x x Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x x x x x x x Impossible WHERE SELECT MIN( a ) FROM t1 WHERE a IS NULL; MIN( a ) NULL @@ -3025,9 +3025,9 @@ INSERT INTO t1 VALUES (28),(29),(9); CREATE TABLE t2 ( a int, KEY (a)) ; INSERT INTO t2 VALUES (1),(1),(1),(4),(4),(5),(5),(8),(8),(9); explain select (select t2.a from t2 where t2.a >= t1.a group by t2.a) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -2 DEPENDENT SUBQUERY t2 index a a 5 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +2 DEPENDENT SUBQUERY t2 NULL index a a 5 NULL 10 Using where; Using index select (select t2.a from t2 where t2.a >= t1.a group by t2.a) from t1; (select t2.a from t2 where t2.a >= t1.a group by t2.a) NULL @@ -3044,10 +3044,10 @@ INSERT INTO t1 VALUES EXPLAIN SELECT alias1.* FROM t1, (SELECT * FROM t1) AS alias1 WHERE EXISTS ( SELECT DISTINCT b FROM t1 WHERE b <= alias1.a ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL b 5 NULL 10 Using index -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) -3 DEPENDENT SUBQUERY t1 index b b 5 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL b 5 NULL 10 Using index +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +3 DEPENDENT SUBQUERY t1 NULL index b b 5 NULL 10 Using where; Using index SELECT alias1.* FROM t1, (SELECT * FROM t1) AS alias1 WHERE EXISTS ( SELECT DISTINCT b FROM t1 WHERE b <= alias1.a ) ; a b @@ -3154,10 +3154,10 @@ a b EXPLAIN SELECT alias1.* FROM t1, t1 AS alias1 WHERE EXISTS ( SELECT DISTINCT b FROM t1 WHERE b <= alias1.a ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL b 5 NULL 10 Using index -1 PRIMARY alias1 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t1 index b b 5 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL b 5 NULL 10 Using index +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t1 NULL index b b 5 NULL 10 Using where; Using index SELECT alias1.* FROM t1, t1 AS alias1 WHERE EXISTS ( SELECT DISTINCT b FROM t1 WHERE b <= alias1.a ) ; a b @@ -3272,38 +3272,38 @@ INSERT INTO t1 VALUES ('7','f'),('8','g'),(NULL,'j'); explain SELECT max(a) , b FROM t1 WHERE a IS NULL OR b = 'z' GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index b b 8 NULL 9 Using where; Using index SELECT max(a) , b FROM t1 WHERE a IS NULL OR b = 'z' GROUP BY b; max(a) b NULL f NULL j explain SELECT b, min(a) FROM t1 WHERE a = '7' OR b = 'z' GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index b b 8 NULL 9 Using where; Using index SELECT b, min(a) FROM t1 WHERE a = '7' OR b = 'z' GROUP BY b; b min(a) d 7 f 7 explain SELECT b, min(a) FROM t1 WHERE (a = b OR b = 'd' OR b is NULL) GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index b b 8 NULL 9 Using where; Using index SELECT b, min(a) FROM t1 WHERE (a = b OR b = 'd' OR b is NULL) GROUP BY b; b min(a) NULL 0 d 4 explain SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref b b 4 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref b b 4 const 1 Using where; Using index SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b; b min(a) explain SELECT b, min(a) FROM t1 WHERE a > '0' AND (b < (a = '7')) GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 8 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL b 8 NULL 9 Using where; Using index SELECT b, min(a) FROM t1 WHERE a > '0' AND (b < (a = '7')) GROUP BY b; b min(a) d 7 @@ -3316,8 +3316,8 @@ Warning 1292 Truncated incorrect DOUBLE value: 'f' Warning 1292 Truncated incorrect DOUBLE value: 'g' explain SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index b b 8 NULL 9 Using where; Using index SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b; b min(a) NULL 9 @@ -3342,28 +3342,28 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK EXPLAIN SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL b 10 NULL 3 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL b 10 NULL 3 Using where; Using index for group-by SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b; MIN(a) b 1 0 9 99 EXPLAIN SELECT MIN(a), b FROM t1 WHERE a > ( SELECT c FROM t2 WHERE c = 0 ) GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range NULL b 10 NULL 3 Using where; Using index for group-by -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range NULL b 10 NULL 3 Using where; Using index for group-by +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT MIN(a), b FROM t1 WHERE a > ( SELECT c FROM t2 WHERE c = 0 ) GROUP BY b; MIN(a) b 1 0 9 99 EXPLAIN SELECT MIN(a), b FROM t1 WHERE a > ( SELECT min(c) FROM t2, t1 t1a, t1 t1b WHERE c = 0 ) GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL b 10 NULL 18 Using where; Using index -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where -2 SUBQUERY t1a index NULL b 10 NULL 18 Using index; Using join buffer (flat, BNL join) -2 SUBQUERY t1b index NULL b 10 NULL 18 Using index; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL b 10 NULL 18 Using where; Using index +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t1a NULL index NULL b 10 NULL 18 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1b NULL index NULL b 10 NULL 18 Using index; Using join buffer (incremental, BNL join) SELECT MIN(a), b FROM t1 WHERE a > ( SELECT min(c) FROM t2, t1 t1a, t1 t1b WHERE c = 0 ) GROUP BY b; MIN(a) b 1 0 @@ -3397,46 +3397,46 @@ test.t1 analyze status OK test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK EXPLAIN SELECT COUNT(DISTINCT a) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 5 NULL 3 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 5 NULL 3 Using index for group-by SELECT COUNT(DISTINCT a) FROM t1; COUNT(DISTINCT a) 2 EXPLAIN SELECT COUNT(DISTINCT a,b) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 10 NULL 33 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 10 NULL 33 Using index for group-by SELECT COUNT(DISTINCT a,b) FROM t1; COUNT(DISTINCT a,b) 32 EXPLAIN SELECT COUNT(DISTINCT b,a) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 10 NULL 33 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 10 NULL 33 Using index for group-by SELECT COUNT(DISTINCT b,a) FROM t1; COUNT(DISTINCT b,a) 32 EXPLAIN SELECT COUNT(DISTINCT b) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 10 NULL 256 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 10 NULL 256 Using index SELECT COUNT(DISTINCT b) FROM t1; COUNT(DISTINCT b) 16 EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 5 NULL 3 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 5 NULL 3 Using index for group-by SELECT COUNT(DISTINCT a) FROM t1 GROUP BY a; COUNT(DISTINCT a) 1 1 EXPLAIN SELECT COUNT(DISTINCT b) FROM t1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 10 NULL 33 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 10 NULL 33 Using index for group-by SELECT COUNT(DISTINCT b) FROM t1 GROUP BY a; COUNT(DISTINCT b) 16 16 EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 10 NULL 256 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 10 NULL 256 Using index; Using filesort SELECT COUNT(DISTINCT a) FROM t1 GROUP BY b; COUNT(DISTINCT a) 2 @@ -3456,94 +3456,94 @@ COUNT(DISTINCT a) 2 2 EXPLAIN SELECT DISTINCT COUNT(DISTINCT a) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 10 NULL 256 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 10 NULL 256 Using index SELECT DISTINCT COUNT(DISTINCT a) FROM t1; COUNT(DISTINCT a) 2 EXPLAIN SELECT COUNT(DISTINCT a, b + 0) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 10 NULL 256 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 10 NULL 256 Using index SELECT COUNT(DISTINCT a, b + 0) FROM t1; COUNT(DISTINCT a, b + 0) 32 EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 HAVING COUNT(DISTINCT b) < 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 10 NULL 256 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 10 NULL 256 Using index SELECT COUNT(DISTINCT a) FROM t1 HAVING COUNT(DISTINCT b) < 10; COUNT(DISTINCT a) EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 HAVING COUNT(DISTINCT c) < 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 256 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 256 SELECT COUNT(DISTINCT a) FROM t1 HAVING COUNT(DISTINCT c) < 10; COUNT(DISTINCT a) 2 EXPLAIN SELECT 1 FROM t1 HAVING COUNT(DISTINCT a) < 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 5 NULL 3 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 5 NULL 3 Using index for group-by SELECT 1 FROM t1 HAVING COUNT(DISTINCT a) < 10; 1 1 EXPLAIN SELECT 1 FROM t1 GROUP BY a HAVING COUNT(DISTINCT b) > 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 10 NULL 33 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 10 NULL 33 Using index for group-by SELECT 1 FROM t1 GROUP BY a HAVING COUNT(DISTINCT b) > 1; 1 1 1 EXPLAIN SELECT COUNT(DISTINCT t1_1.a) FROM t1 t1_1, t1 t1_2 GROUP BY t1_1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1_1 index NULL a 10 NULL 256 Using index; Using temporary; Using filesort -1 SIMPLE t1_2 index NULL a 10 NULL 256 Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1_1 NULL index NULL a 10 NULL 256 Using index; Using temporary; Using filesort +1 SIMPLE t1_2 NULL index NULL a 10 NULL 256 Using index; Using join buffer (flat, BNL join) SELECT COUNT(DISTINCT t1_1.a) FROM t1 t1_1, t1 t1_2 GROUP BY t1_1.a; COUNT(DISTINCT t1_1.a) 1 1 EXPLAIN SELECT COUNT(DISTINCT a), 12 FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 5 NULL 3 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 5 NULL 3 Using index for group-by SELECT COUNT(DISTINCT a), 12 FROM t1; COUNT(DISTINCT a) 12 2 12 EXPLAIN SELECT COUNT(DISTINCT a, b, c) FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL a 15 NULL 17 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL a 15 NULL 17 Using index for group-by SELECT COUNT(DISTINCT a, b, c) FROM t2; COUNT(DISTINCT a, b, c) 16 EXPLAIN SELECT COUNT(DISTINCT a), SUM(DISTINCT a), AVG(DISTINCT a) FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL a 5 NULL 3 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL a 5 NULL 3 Using index for group-by SELECT COUNT(DISTINCT a), SUM(DISTINCT a), AVG(DISTINCT a) FROM t2; COUNT(DISTINCT a) SUM(DISTINCT a) AVG(DISTINCT a) 2 3 1.5000 EXPLAIN SELECT COUNT(DISTINCT a), SUM(DISTINCT a), AVG(DISTINCT f) FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 256 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 256 SELECT COUNT(DISTINCT a), SUM(DISTINCT a), AVG(DISTINCT f) FROM t2; COUNT(DISTINCT a) SUM(DISTINCT a) AVG(DISTINCT f) 2 3 1.0000 EXPLAIN SELECT COUNT(DISTINCT a, b), COUNT(DISTINCT b, a) FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL a 10 NULL 17 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL a 10 NULL 17 Using index for group-by SELECT COUNT(DISTINCT a, b), COUNT(DISTINCT b, a) FROM t2; COUNT(DISTINCT a, b) COUNT(DISTINCT b, a) 16 16 EXPLAIN SELECT COUNT(DISTINCT a, b), COUNT(DISTINCT b, f) FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 256 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 256 SELECT COUNT(DISTINCT a, b), COUNT(DISTINCT b, f) FROM t2; COUNT(DISTINCT a, b) COUNT(DISTINCT b, f) 16 8 EXPLAIN SELECT COUNT(DISTINCT a, b), COUNT(DISTINCT b, d) FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 256 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 256 SELECT COUNT(DISTINCT a, b), COUNT(DISTINCT b, d) FROM t2; COUNT(DISTINCT a, b) COUNT(DISTINCT b, d) 16 8 EXPLAIN SELECT a, c, COUNT(DISTINCT c, a, b) FROM t2 GROUP BY a, b, c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL a 15 NULL 17 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL a 15 NULL 17 Using index for group-by SELECT a, c, COUNT(DISTINCT c, a, b) FROM t2 GROUP BY a, b, c; a c COUNT(DISTINCT c, a, b) 1 1 1 @@ -3564,61 +3564,61 @@ a c COUNT(DISTINCT c, a, b) 2 1 1 EXPLAIN SELECT COUNT(DISTINCT c, a, b) FROM t2 WHERE a > 5 AND b BETWEEN 10 AND 20 GROUP BY a, b, c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 5 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 5 NULL 1 Using where; Using index SELECT COUNT(DISTINCT c, a, b) FROM t2 WHERE a > 5 AND b BETWEEN 10 AND 20 GROUP BY a, b, c; COUNT(DISTINCT c, a, b) EXPLAIN SELECT COUNT(DISTINCT b), SUM(DISTINCT b) FROM t2 WHERE a = 5 GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 5 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref a a 5 const 1 Using where; Using index SELECT COUNT(DISTINCT b), SUM(DISTINCT b) FROM t2 WHERE a = 5 GROUP BY b; COUNT(DISTINCT b) SUM(DISTINCT b) EXPLAIN SELECT a, COUNT(DISTINCT b), SUM(DISTINCT b) FROM t2 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL a 10 NULL 17 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL a 10 NULL 17 Using index for group-by SELECT a, COUNT(DISTINCT b), SUM(DISTINCT b) FROM t2 GROUP BY a; a COUNT(DISTINCT b) SUM(DISTINCT b) 1 8 36 2 8 36 EXPLAIN SELECT COUNT(DISTINCT b), SUM(DISTINCT b) FROM t2 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL a 10 NULL 17 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL a 10 NULL 17 Using index for group-by SELECT COUNT(DISTINCT b), SUM(DISTINCT b) FROM t2 GROUP BY a; COUNT(DISTINCT b) SUM(DISTINCT b) 8 36 8 36 EXPLAIN SELECT COUNT(DISTINCT a, b) FROM t2 WHERE c = 13 AND d = 42; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 256 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 256 Using where SELECT COUNT(DISTINCT a, b) FROM t2 WHERE c = 13 AND d = 42; COUNT(DISTINCT a, b) 0 EXPLAIN SELECT a, COUNT(DISTINCT a), SUM(DISTINCT a) FROM t2 WHERE b = 13 AND c = 42 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL a 15 NULL 3 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL a 15 NULL 3 Using where; Using index for group-by SELECT a, COUNT(DISTINCT a), SUM(DISTINCT a) FROM t2 WHERE b = 13 AND c = 42 GROUP BY a; a COUNT(DISTINCT a) SUM(DISTINCT a) EXPLAIN SELECT COUNT(DISTINCT a, b), SUM(DISTINCT a) FROM t2 WHERE b = 42; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 15 NULL 256 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 256 Using where; Using index SELECT COUNT(DISTINCT a, b), SUM(DISTINCT a) FROM t2 WHERE b = 42; COUNT(DISTINCT a, b) SUM(DISTINCT a) 0 NULL EXPLAIN SELECT SUM(DISTINCT a), MAX(b) FROM t2 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 15 NULL 256 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 256 Using index SELECT SUM(DISTINCT a), MAX(b) FROM t2 GROUP BY a; SUM(DISTINCT a) MAX(b) 1 8 2 8 EXPLAIN SELECT 42 * (a + c + COUNT(DISTINCT c, a, b)) FROM t2 GROUP BY a, b, c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL a 15 NULL 17 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range NULL a 15 NULL 17 Using index for group-by SELECT 42 * (a + c + COUNT(DISTINCT c, a, b)) FROM t2 GROUP BY a, b, c; 42 * (a + c + COUNT(DISTINCT c, a, b)) 126 @@ -3638,8 +3638,8 @@ SELECT 42 * (a + c + COUNT(DISTINCT c, a, b)) FROM t2 GROUP BY a, b, c; 168 168 EXPLAIN SELECT (SUM(DISTINCT a) + MAX(b)) FROM t2 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 15 NULL 256 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 256 Using index SELECT (SUM(DISTINCT a) + MAX(b)) FROM t2 GROUP BY a; (SUM(DISTINCT a) + MAX(b)) 9 @@ -3663,8 +3663,8 @@ f1 COUNT(DISTINCT f2) 2 1 3 4 explain SELECT f1, COUNT(DISTINCT f2) FROM t1 GROUP BY f1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL f1 5 NULL 9 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL f1 5 NULL 9 Using index for group-by drop table t1; # End of test#50539. # @@ -3684,8 +3684,8 @@ a SUM(DISTINCT a) MIN(b) 3 3 2 4 4 4 EXPLAIN SELECT a, SUM(DISTINCT a), MIN(b) FROM t GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t index NULL a 10 NULL 7 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t NULL index NULL a 10 NULL 7 Using index SELECT a, SUM(DISTINCT a), MAX(b) FROM t GROUP BY a; a SUM(DISTINCT a) MAX(b) 1 1 1 @@ -3693,8 +3693,8 @@ a SUM(DISTINCT a) MAX(b) 3 3 3 4 4 5 EXPLAIN SELECT a, SUM(DISTINCT a), MAX(b) FROM t GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t index NULL a 10 NULL 7 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t NULL index NULL a 10 NULL 7 Using index SELECT a, MAX(b) FROM t GROUP BY a HAVING SUM(DISTINCT a); a MAX(b) 1 1 @@ -3702,14 +3702,14 @@ a MAX(b) 3 3 4 5 EXPLAIN SELECT a, MAX(b) FROM t GROUP BY a HAVING SUM(DISTINCT a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t index NULL a 10 NULL 7 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t NULL index NULL a 10 NULL 7 Using index SELECT SUM(DISTINCT a), MIN(b), MAX(b) FROM t; SUM(DISTINCT a) MIN(b) MAX(b) 10 0 5 EXPLAIN SELECT SUM(DISTINCT a), MIN(b), MAX(b) FROM t; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t index NULL a 10 NULL 7 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t NULL index NULL a 10 NULL 7 Using index SELECT a, SUM(DISTINCT a), MIN(b), MAX(b) FROM t GROUP BY a; a SUM(DISTINCT a) MIN(b) MAX(b) 1 1 0 1 @@ -3717,8 +3717,8 @@ a SUM(DISTINCT a) MIN(b) MAX(b) 3 3 2 3 4 4 4 5 EXPLAIN SELECT a, SUM(DISTINCT a), MIN(b), MAX(b) FROM t GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t index NULL a 10 NULL 7 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t NULL index NULL a 10 NULL 7 Using index DROP TABLE t; # # MDEV-4219 A simple select query returns random data (upstream bug#68473) @@ -3740,8 +3740,8 @@ INSERT INTO faulty (b, c) VALUES (5, '2009-02-15 17:00:00'); EXPLAIN SELECT DISTINCT b, c FROM faulty WHERE b='1802' ORDER BY c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE faulty ref b_and_c b_and_c 4 const 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE faulty NULL ref b_and_c b_and_c 4 const 2 Using where; Using index SELECT DISTINCT b, c FROM faulty WHERE b='1802' ORDER BY c; b c 1802 2013-02-28 09:00:00 @@ -3759,8 +3759,8 @@ test.t1 analyze status OK CREATE INDEX break_it ON t1 (a, b); EXPLAIN SELECT distinct a, b FROM t1 where a = '3' ORDER BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range break_it break_it 10 NULL 2 Using where; Using index for group-by; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range break_it break_it 10 NULL 2 Using where; Using index for group-by; Using filesort SELECT distinct a, b FROM t1 where a = '3' ORDER BY b; a b 3 1 @@ -3821,19 +3821,19 @@ set @save_use_stat_tables= @@use_stat_tables; set @@optimizer_use_condition_selectivity=4; set @@use_stat_tables=PREFERABLY; explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5 100.00 -1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 7 100.00 Using index -2 MATERIALIZED t1 range NULL a 5 NULL 5 100.00 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 5 100.00 +1 PRIMARY t1_outer NULL ref a a 5 <subquery2>.max(b) 7 100.00 Using index +2 MATERIALIZED t1 NULL range NULL a 5 NULL 5 100.00 Using index for group-by Warnings: Note 1003 /* select#1 */ select `test`.`t1_outer`.`a` AS `a` from <materialize> (/* select#2 */ select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where `test`.`t1_outer`.`a` = `<subquery2>`.`max(b)` set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set @@use_stat_tables=@save_use_stat_tables; explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5 100.00 -1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 7 100.00 Using index -2 MATERIALIZED t1 range NULL a 5 NULL 5 100.00 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 5 100.00 +1 PRIMARY t1_outer NULL ref a a 5 <subquery2>.max(b) 7 100.00 Using index +2 MATERIALIZED t1 NULL range NULL a 5 NULL 5 100.00 Using index for group-by Warnings: Note 1003 /* select#1 */ select `test`.`t1_outer`.`a` AS `a` from <materialize> (/* select#2 */ select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where `test`.`t1_outer`.`a` = `<subquery2>`.`max(b)` drop table t1; @@ -3868,14 +3868,14 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='2001-01-04' GROUP BY id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL id 8 NULL 5 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL id 8 NULL 5 Using where; Using index for group-by EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104.0 GROUP BY id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL id 8 NULL 5 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL id 8 NULL 5 Using where; Using index for group-by EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL id 8 NULL 5 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL id 8 NULL 5 Using where; Using index for group-by SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='2001-01-04' GROUP BY id; id MIN(a) MAX(a) 1 2001-01-04 2001-01-04 @@ -3976,20 +3976,20 @@ id MIN(a) MAX(a) 3 2001-01-04 2001-01-04 4 2001-01-04 2001-01-04 EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL id 27 NULL 10 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL id 27 NULL 10 Using where; Using index for group-by EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND '2001-01-05' GROUP BY id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL id 27 NULL 10 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL id 27 NULL 10 Using where; Using index for group-by EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL id 27 NULL 64 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL id 27 NULL 64 Using where; Using index EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL id 27 NULL 64 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL id 27 NULL 64 Using where; Using index EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL id 27 NULL 64 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL id 27 NULL 64 Using where; Using index DROP TABLE t1; # # MIN() optimization didn't work correctly with BETWEEN when using too @@ -3998,14 +3998,14 @@ DROP TABLE t1; create table t1 (a varchar(10), key (a)) engine=myisam; insert into t1 values("bar"),("Cafe"); explain select min(a) from t1 where a between "a" and "Cafe2"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select min(a) from t1 where a between "a" and "Cafeeeeeeeeeeeeeeeeeeeeeeeeee"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 13 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 13 NULL 2 Using where; Using index explain select min(a) from t1 where a between "abbbbbbbbbbbbbbbbbbbb" and "Cafe2"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 13 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 13 NULL 2 Using where; Using index drop table t1; # # MDEV-15433: Optimizer does not use group by optimization with distinct @@ -4015,8 +4015,8 @@ OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK EXPLAIN SELECT DISTINCT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 4 NULL 5 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 4 NULL 5 Using index for group-by SELECT DISTINCT a FROM t1; a 1 @@ -4034,9 +4034,9 @@ CREATE TABLE t1 (a int, b int, KEY b (b,a)) ENGINE=MyISAM; INSERT INTO t1 VALUES (0,100),(2,100),(2,101),(3,102); # Must not use Using index for group-by explain SELECT DISTINCT b FROM t1 WHERE EXISTS ( SELECT 1 FROM DUAL WHERE a > 1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL b 10 NULL 4 Using where; Using index -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL b 10 NULL 4 Using where; Using index +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used SELECT DISTINCT b FROM t1 WHERE EXISTS ( SELECT 1 FROM DUAL WHERE a > 1 ); b 100 @@ -4058,8 +4058,8 @@ INSERT INTO t1 (owner_id, foo, whatever) VALUES (1, TRUE, "yello"), (1, FALSE, "yello"), (2, TRUE, "yello"), (2, TRUE, "yello"), (2, FALSE, "yello"); EXPLAIN SELECT DISTINCT owner_id FROM t1 WHERE foo = true GROUP BY owner_id HAVING (COUNT(*) = 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL index_t1_on_owner_id_and_foo 7 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL index_t1_on_owner_id_and_foo 7 NULL 5 Using where; Using index SELECT DISTINCT owner_id FROM t1 WHERE foo = true GROUP BY owner_id HAVING (COUNT(*) = 1); owner_id 1 @@ -4070,14 +4070,14 @@ DROP TABLE t1; CREATE TABLE t1 (p int NOT NULL, a int NOT NULL, PRIMARY KEY (p,a)); insert into t1 select 2,seq from seq_0_to_1000; EXPLAIN select MIN(a) from t1 where p = 2 group by p; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 10 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 10 Using where; Using index for group-by SELECT MIN(a) from t1 where p = 2 group by p; MIN(a) 0 EXPLAIN select MIN(a) from t1 group by p; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL PRIMARY 4 NULL 10 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL PRIMARY 4 NULL 10 Using index for group-by SELECT MIN(a) from t1 where p = 2; MIN(a) 0 diff --git a/mysql-test/main/group_min_max.test b/mysql-test/main/group_min_max.test index daa407121cf..eceba51e443 100644 --- a/mysql-test/main/group_min_max.test +++ b/mysql-test/main/group_min_max.test @@ -179,7 +179,7 @@ explain select a1, max(a2) from t1 group by a1; explain select a1, min(a2), max(a2) from t1 group by a1; explain select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b; explain select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b; ---replace_column 7 # 9 # +--replace_column 8 # 10 # explain select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b; # Select fields in different order explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1; @@ -218,29 +218,29 @@ explain select a1,a2,b,min(c),max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = explain select a1,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b; explain select a1, max(c) from t1 where a1 in ('a','b','d') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b, max(c) from t2 where a1 < 'd' group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where a1 < 'd' group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where a1 >= 'c' or a2 < 'b' group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b, max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b, max(c) from t2 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1, max(c) from t2 where a1 in ('a','b','d') group by a1,a2,b; # queries @@ -323,7 +323,7 @@ select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2; # C) Range predicates for the MIN/MAX attribute # plans ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b, max(c) from t1 where (c > 'b1') group by a1,a2,b; explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') group by a1,a2,b; explain select a1,a2,b, max(c) from t1 where (c > 'f123') group by a1,a2,b; @@ -341,35 +341,35 @@ explain select a1,a2,b,min(c),max(c) from t1 where (c < 'c5') or (c = 'g412') or explain select a1,a2,b,min(c),max(c) from t1 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b; explain select a1,a2,b,min(c),max(c) from t1 where (c between 'b111' and 'g112') or (c between 'd000' and 'i110') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b, max(c) from t2 where (c > 'b1') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b, max(c) from t2 where (c > 'f123') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where (c > 'f123') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b, max(c) from t2 where (c < 'a0') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b, max(c) from t2 where (c < 'k321') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where (c < 'k321') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b, max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b, max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b111') and (c <= 'g112') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b; # queries @@ -483,17 +483,17 @@ explain select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 explain select a1,a2,b,min(c) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; explain select a1,a2,b,min(c) from t1 where (ord(a1) > 97) and (ord(a2) + ord(a1) > 194) and (b = 'c') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c),max(c) from t2 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c) from t2 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c) from t2 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,min(c) from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; # queries @@ -523,13 +523,13 @@ explain select a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b; explain select a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b; explain select a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; # queries @@ -554,12 +554,12 @@ explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c'); explain select distinct b from t1 where (a2 >= 'b') and (b = 'a'); ---replace_column 9 # +--replace_column 10 # explain select distinct a1,a2,b from t2; ---replace_column 9 # +--replace_column 10 # explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a'); explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121'); ---replace_column 9 # +--replace_column 10 # explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c'); explain select distinct b from t2 where (a2 >= 'b') and (b = 'a'); @@ -598,15 +598,15 @@ explain select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; explain select distinct b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select distinct a1,a2,b from t2; ---replace_column 9 # +--replace_column 10 # explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; ---replace_column 9 # +--replace_column 10 # explain select distinct b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b; # queries diff --git a/mysql-test/main/group_min_max_innodb.result b/mysql-test/main/group_min_max_innodb.result index 3586ad5237f..bd611bb02bd 100644 --- a/mysql-test/main/group_min_max_innodb.result +++ b/mysql-test/main/group_min_max_innodb.result @@ -72,11 +72,11 @@ create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb; insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d"); alter table t1 drop primary key, add primary key (f2, f1); explain select distinct f1 a, f1 b from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 5 NULL 4 Using index; Using temporary explain select distinct f1, f2 from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 5 NULL 4 Using index drop table t1; create table t1(pk int primary key) engine=innodb; create view v1 as select pk from t1 where pk < 20; @@ -107,8 +107,8 @@ End of 5.1 tests CREATE TABLE t1 (a CHAR(1), b CHAR(1), PRIMARY KEY (a,b)) ENGINE=InnoDB; INSERT INTO t1 VALUES ('a', 'b'), ('c', 'd'); EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 WHERE b = 'b'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 2 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 2 NULL 2 Using where; Using index SELECT COUNT(DISTINCT a) FROM t1 WHERE b = 'b'; COUNT(DISTINCT a) 1 @@ -117,8 +117,8 @@ CREATE TABLE t1 (a CHAR(1) NOT NULL, b CHAR(1) NOT NULL, UNIQUE KEY (a,b)) ENGINE=InnoDB; INSERT INTO t1 VALUES ('a', 'b'), ('c', 'd'); EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 WHERE b = 'b'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 2 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 2 NULL 2 Using where; Using index SELECT COUNT(DISTINCT a) FROM t1 WHERE b = 'b'; COUNT(DISTINCT a) 1 @@ -161,8 +161,8 @@ ANALYZE TABLE t1; ANALYZE TABLE t2; EXPLAIN SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' AND i2 = 17) OR ( c1 = 'F') GROUP BY c1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range k1 k1 5 NULL 31 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range k1 k1 5 NULL 31 Using where; Using index SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' AND i2 = 17) OR ( c1 = 'F') GROUP BY c1; c1 max(i2) @@ -170,8 +170,8 @@ C 17 F 30 EXPLAIN SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR ( c1 = 'F' AND i2 = 17)) GROUP BY c1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range k1 k1 5 NULL 31 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range k1 k1 5 NULL 31 Using where; Using index SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR ( c1 = 'F' AND i2 = 17)) GROUP BY c1; c1 max(i2) @@ -179,8 +179,8 @@ C 30 F 17 EXPLAIN SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR c1 = 'F' ) AND ( i2 = 17 ) GROUP BY c1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range k1 k1 5 NULL 1 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range k1 k1 5 NULL 1 Using where; Using index for group-by SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR c1 = 'F' ) AND ( i2 = 17 ) GROUP BY c1; c1 max(i2) @@ -189,8 +189,8 @@ F 17 EXPLAIN SELECT c1, max(i2) FROM t1 WHERE ((c1 = 'C' AND (i2 = 40 OR i2 = 30)) OR ( c1 = 'F' AND (i2 = 40 ))) GROUP BY c1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range k1 k1 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range k1 k1 5 NULL 3 Using where; Using index SELECT c1, max(i2) FROM t1 WHERE ((c1 = 'C' AND (i2 = 40 OR i2 = 30)) OR ( c1 = 'F' AND (i2 = 40 ))) GROUP BY c1; @@ -199,8 +199,8 @@ C 30 EXPLAIN SELECT c1, i1, max(i2) FROM t2 WHERE (c1 = 'C' OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 ) GROUP BY c1,i1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range k2 k2 9 NULL 60 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range k2 k2 9 NULL 60 Using where; Using index for group-by SELECT c1, i1, max(i2) FROM t2 WHERE (c1 = 'C' OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 ) GROUP BY c1,i1; @@ -210,8 +210,8 @@ F 17 17 EXPLAIN SELECT c1, i1, max(i2) FROM t2 WHERE (((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 )) GROUP BY c1,i1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range k2 k2 9 NULL 60 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range k2 k2 9 NULL 60 Using where; Using index for group-by SELECT c1, i1, max(i2) FROM t2 WHERE (((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 )) GROUP BY c1,i1; @@ -221,8 +221,8 @@ F 17 17 EXPLAIN SELECT c1, i1, max(i2) FROM t2 WHERE ((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35) OR ( i2 = 17 )) GROUP BY c1,i1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index k2 k2 9 NULL 180 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index k2 k2 9 NULL 180 Using where; Using index SELECT c1, i1, max(i2) FROM t2 WHERE ((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35) OR ( i2 = 17 )) GROUP BY c1,i1; diff --git a/mysql-test/main/having.result b/mysql-test/main/having.result index 7106b42fc8d..201d169e415 100644 --- a/mysql-test/main/having.result +++ b/mysql-test/main/having.result @@ -9,8 +9,8 @@ select count(a) as b from t1 where a=0 having b >=0; b 0 explain extended select count(a) as b from t1 where a=0 having b >=0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select count(NULL) AS `b` from dual where 0 having `b` >= 0 drop table t1; @@ -152,11 +152,11 @@ a SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1; x a EXPLAIN SELECT a FROM t1 GROUP BY a HAVING 1 != 1 AND a > 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING EXPLAIN SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING DROP table t1; CREATE TABLE t1 (a int PRIMARY KEY); CREATE TABLE t2 (b int PRIMARY KEY, a int); @@ -469,8 +469,8 @@ JOIN t1 AS table2 ON table1.f3 = table2.f3 WHERE table2.f1 = 2 GROUP BY table1.f1, table2.f2 HAVING (table2.f2 = 8 AND table1.f1 >= 6); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 0 AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where 0 group by 0,7 having 1 EXPLAIN EXTENDED @@ -480,8 +480,8 @@ JOIN t1 AS table2 ON table1.f3 = table2.f3 WHERE table2.f1 = 2 GROUP BY table1.f1, table2.f2 HAVING (table2.f2 = 8); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where 0 group by `test`.`table1`.`f1`,7 having 1 DROP TABLE t1; @@ -595,8 +595,8 @@ SELECT MAX(t1.b) FROM t1,t2 WHERE t2.a > 0 HAVING MAX(t1.b) IS NULL; MAX(t1.b) EXPLAIN SELECT MAX(t1.b) FROM t1,t2 WHERE t2.a < 0 HAVING MAX(t1.b) <> 6; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT MAX(t1.b) FROM t1,t2 WHERE t2.a < 0 HAVING MAX(t1.b) <> 6; MAX(t1.b) CREATE TABLE t3 ( f3 int) ; @@ -626,10 +626,10 @@ SELECT MIN( t1.f10 ) AS field1 FROM t1 , t2 WHERE t2.f2 IN ( SELECT f3 FROM t3 ) HAVING field1 < 's'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t1 index NULL f10 4 NULL 2 100.00 Using index -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t1 NULL index NULL f10 4 NULL 2 100.00 Using index +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 /* select#1 */ select min(`test`.`t1`.`f10`) AS `field1` from `test`.`t1` where <expr_cache><7>(<in_optimizer>(7,<exists>(/* select#2 */ select `test`.`t3`.`f3` from `test`.`t3` where <cache>(7) = `test`.`t3`.`f3`))) having `field1` < 's' set optimizer_switch=@save_optimizer_switch; @@ -715,8 +715,8 @@ drop table t1; # explain extended select * from mysql.help_topic where example = 'foo' having description is null; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING Warnings: Note 1003 select `mysql`.`help_topic`.`help_topic_id` AS `help_topic_id`,`mysql`.`help_topic`.`name` AS `name`,`mysql`.`help_topic`.`help_category_id` AS `help_category_id`,`mysql`.`help_topic`.`description` AS `description`,`mysql`.`help_topic`.`example` AS `example`,`mysql`.`help_topic`.`url` AS `url` from `mysql`.`help_topic` where `mysql`.`help_topic`.`example` = 'foo' having 0 select * from mysql.help_topic where example = 'foo' having description is null; @@ -838,8 +838,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain SELECT t, next_seq_value() r FROM t1 FORCE INDEX(t) GROUP BY t HAVING r = 1 ORDER BY t1.u; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using temporary; Using filesort SELECT t, next_seq_value() r FROM t1 FORCE INDEX(t) GROUP BY t HAVING r = 1 ORDER BY t1.u; t r 10 1 diff --git a/mysql-test/main/having_cond_pushdown.result b/mysql-test/main/having_cond_pushdown.result index 443745db643..fb1305ed024 100644 --- a/mysql-test/main/having_cond_pushdown.result +++ b/mysql-test/main/having_cond_pushdown.result @@ -24,8 +24,8 @@ explain SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a HAVING (t1.a>2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a @@ -95,8 +95,8 @@ explain SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a HAVING (t1.a=2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a @@ -158,8 +158,8 @@ explain SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a HAVING (t1.a>1) AND (t1.a<4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a @@ -231,8 +231,8 @@ explain SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a HAVING (t1.a>1) OR (a IN (SELECT 3)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort Warnings: Note 1249 Select 2 was reduced during optimization explain format=json SELECT t1.a,MAX(t1.b) @@ -309,8 +309,8 @@ explain SELECT t1.a,MAX(t1.b),MIN(t1.c) FROM t1 GROUP BY t1.a HAVING ((t1.a>2) AND (MAX(t1.b)>13)) OR ((t1.a<3) AND (MIN(t1.c)>1)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),MIN(t1.c) FROM t1 GROUP BY t1.a @@ -383,8 +383,8 @@ explain SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a HAVING (t1.a>1) AND (MAX(t1.a)<3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a @@ -456,8 +456,8 @@ explain SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a HAVING (t1.a>1) AND (MAX(t1.b)>13); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a @@ -529,8 +529,8 @@ explain SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a HAVING (t1.a=3) AND (MAX(t1.a)=3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a @@ -592,8 +592,8 @@ explain SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a HAVING (t1.a=2) AND (MAX(t1.b)>12); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a @@ -655,8 +655,8 @@ explain SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a HAVING (t1.a>1) AND (MAX(t1.b)=13); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a @@ -730,8 +730,8 @@ explain SELECT t1.a,MIN(t1.c) FROM t1 GROUP BY t1.a HAVING (t1.a>1) AND (MIN(t1.c)<3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MIN(t1.c) FROM t1 GROUP BY t1.a @@ -803,8 +803,8 @@ explain SELECT t1.a,MAX(t1.b),MIN(t1.c) FROM t1 GROUP BY t1.a HAVING (t1.a=2) AND (MAX(t1.b)=13) AND (MIN(t1.c)=2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,MAX(t1.b),MIN(t1.c) FROM t1 GROUP BY t1.a @@ -867,8 +867,8 @@ explain SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a HAVING (t1.a>1) AND (a=test.f1()); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b) FROM t1 GROUP BY t1.a @@ -946,10 +946,10 @@ FROM t2,v1 WHERE (t2.x=v1.a) GROUP BY v1.a HAVING (v1.a>1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort -1 PRIMARY <derived2> ref key0 key0 5 test.t2.x 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.x 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT v1.a FROM t2,v1 WHERE (t2.x=v1.a) @@ -1093,10 +1093,10 @@ FROM t2,v1 WHERE (t2.x=v1.a) GROUP BY v1.c HAVING (v1.c>2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort -1 PRIMARY <derived2> ref key0 key0 5 test.t2.x 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.x 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 Using temporary; Using filesort explain format=json SELECT v1.a,v1.c FROM t2,v1 WHERE (t2.x=v1.a) @@ -1243,10 +1243,10 @@ WHERE (t1.a,t1.b) IN (SELECT t2.x,MAX(t2.y) FROM t2 WHERE t2.x<5 GROUP BY t2.x) GROUP BY t1.a HAVING (t1.a>1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where; Using temporary explain format=json SELECT * FROM t1 WHERE (t1.a,t1.b) IN (SELECT t2.x,MAX(t2.y) FROM t2 WHERE t2.x<5 GROUP BY t2.x) @@ -1386,10 +1386,10 @@ WHERE (t1.a,t1.b) IN (SELECT t2.x,MAX(t2.y) FROM t2 WHERE t2.x<5 GROUP BY t2.x) GROUP BY t1.b HAVING (t1.b<14); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where; Using temporary explain format=json SELECT * FROM t1 WHERE (t1.a,t1.b) IN (SELECT t2.x,MAX(t2.y) FROM t2 WHERE t2.x<5 GROUP BY t2.x) @@ -1528,8 +1528,8 @@ explain SELECT t1.a,MAX(t1.b),t1.c FROM t1 GROUP BY t1.a HAVING (t1.c=2) AND (t1.a>1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 GROUP BY t1.a @@ -1600,8 +1600,8 @@ explain SELECT MAX(t1.a),t1.a,t1.b,t1.c FROM t1 GROUP BY t1.b HAVING (t1.a=2) AND (t1.b=13) AND (t1.c=2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT MAX(t1.a),t1.a,t1.b,t1.c FROM t1 GROUP BY t1.b @@ -1664,8 +1664,8 @@ explain SELECT t1.a,MAX(t1.b),t1.c FROM t1 GROUP BY t1.a HAVING (t1.a=t1.c) AND (t1.c>1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 GROUP BY t1.a @@ -1733,8 +1733,8 @@ explain SELECT t1.a,MAX(t1.b),t1.c FROM t1 GROUP BY t1.a HAVING (t1.a=t1.c) AND (t1.c=2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 GROUP BY t1.a @@ -1793,8 +1793,8 @@ explain SELECT t1.a,MAX(t1.b),t1.c FROM t1 GROUP BY t1.a HAVING ((t1.a=t1.c) AND (t1.a>1)) OR ((t1.a<3) AND (t1.c>3)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 GROUP BY t1.a @@ -1872,8 +1872,8 @@ FROM t1 WHERE (t1.a=t1.c) GROUP BY t1.a HAVING (t1.c<3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a=t1.c) @@ -1947,8 +1947,8 @@ FROM t1 WHERE (t1.a=t1.c) GROUP BY t1.a HAVING (t1.a>1) AND (t1.c<3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a=t1.c) @@ -2021,8 +2021,8 @@ FROM t1 WHERE (t1.a=t1.c) GROUP BY t1.a HAVING (((t1.a>1) AND (MAX(t1.c)<3)) OR (t1.c<4)) AND (t1.a<2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a=t1.c) @@ -2101,8 +2101,8 @@ FROM t1 WHERE (t1.a=t1.c) GROUP BY t1.a HAVING ((t1.a>1) AND (MAX(t1.c)<3)) OR (t1.c<4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a=t1.c) @@ -2171,8 +2171,8 @@ SELECT a FROM t1 WHERE b = 1 AND b = 2 GROUP BY a HAVING a <= 3; a EXPLAIN SELECT a FROM t1 WHERE b = 1 AND b = 2 GROUP BY a HAVING a <= 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE DROP TABLE t1; # # MDEV-18769: unfixed OR condition pushed from HAVING into WHERE @@ -2198,8 +2198,8 @@ explain SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a HAVING t1.b = 13 AND MAX(t1.c) > 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using temporary; Using filesort explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a @@ -2271,8 +2271,8 @@ explain SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.b HAVING (t1.a = 1 OR t1.b > 10) AND (t1.b < 14); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.b @@ -2345,8 +2345,8 @@ explain SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.b HAVING (t1.a = 1 OR t1.b > 10) AND (t1.b < 14 OR t1.b > 15); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.b @@ -2418,8 +2418,8 @@ explain SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.b HAVING (t1.a = 1 OR t1.b > 10) AND (t1.b < 14 OR (t1.b > 15 AND t1.a = 2)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.b @@ -2493,8 +2493,8 @@ explain SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.b HAVING (t1.a < 2) OR (t1.b = 13 AND t1.a > 2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.b @@ -2565,8 +2565,8 @@ explain SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.b HAVING (t1.a < 2 AND t1.b = 14) OR (t1.a > 2 AND t1.b = 13); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.b @@ -2639,8 +2639,8 @@ explain SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.b HAVING (t1.a < 2 AND t1.b = 14) OR (t1.a > 2 AND (t1.b = 13 OR t1.b = 14)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.b @@ -2709,8 +2709,8 @@ explain SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a HAVING (t1.a < 2 AND MAX(t1.c) = 2) OR (MAX(t1.c) > 2 AND (t1.a = 1 OR t1.a = 2)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a @@ -2784,8 +2784,8 @@ explain SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a HAVING (t1.a = 2 AND MAX(t1.c) = 2) OR (MAX(t1.c) > 2 AND (t1.a = 1 OR t1.a = 2)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a @@ -2858,8 +2858,8 @@ explain SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a HAVING (t1.a = 1) AND (MAX(t1.c) = 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a @@ -2922,8 +2922,8 @@ explain SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.c HAVING (t1.a = 1) AND (t1.c = 3) AND MAX(t1.b = 14); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.c @@ -2985,8 +2985,8 @@ explain SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.c HAVING (t1.a = 1) AND (t1.c = 1) AND MAX(t1.b = 14); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 GROUP BY t1.a,t1.c @@ -3057,8 +3057,8 @@ FROM t1 WHERE (t1.b > 2) GROUP BY t1.a HAVING (t1.a < 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 WHERE (t1.b > 2) @@ -3132,8 +3132,8 @@ FROM t1 WHERE (t1.b > 2) GROUP BY t1.a HAVING (t1.a = 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 WHERE (t1.b > 2) @@ -3197,8 +3197,8 @@ FROM t1 WHERE (t1.b = 14) GROUP BY t1.a HAVING (t1.a < 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 WHERE (t1.b = 14) @@ -3272,8 +3272,8 @@ FROM t1 WHERE (t1.b = 14) GROUP BY t1.a HAVING (t1.a = 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,t1.b,MAX(t1.c) FROM t1 WHERE (t1.b = 14) @@ -3335,8 +3335,8 @@ FROM t1 WHERE (t1.a = 3) GROUP BY t1.a HAVING (t1.a = 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain format=json SELECT t1.a,MAX(t1.c) FROM t1 WHERE (t1.a = 3) @@ -3384,8 +3384,8 @@ FROM t1 WHERE (t1.c = 1) GROUP BY t1.a HAVING (t1.a = 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.c = 1) @@ -3451,8 +3451,8 @@ FROM t1 WHERE (t1.c > 0) AND (t1.c < 3) GROUP BY t1.a HAVING (t1.a > 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.c > 0) AND (t1.c < 3) @@ -3526,8 +3526,8 @@ FROM t1 WHERE (t1.c > 0) AND (t1.c < 3) GROUP BY t1.a HAVING (t1.a = 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.c > 0) AND (t1.c < 3) @@ -3591,8 +3591,8 @@ FROM t1 WHERE (t1.a > 0) AND (t1.c < 3) GROUP BY t1.a HAVING (t1.a = 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a > 0) AND (t1.c < 3) @@ -3654,8 +3654,8 @@ FROM t1 WHERE (t1.a = 0) AND (t1.a = 3) GROUP BY t1.a HAVING (t1.a = 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain format=json SELECT t1.a,MAX(t1.b) FROM t1 WHERE (t1.a = 0) AND (t1.a = 3) @@ -3702,8 +3702,8 @@ FROM t3 WHERE (t3.b = 2) AND (t3.d = 1) GROUP BY t3.a,t3.b,t3.d HAVING (t3.a = 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 Using where explain format=json SELECT t3.a,t3.b,MAX(t3.c),t3.d FROM t3 WHERE (t3.b = 2) AND (t3.d = 1) @@ -3767,8 +3767,8 @@ FROM t1 WHERE (t1.a > 1) OR (t1.c < 3) GROUP BY t1.a HAVING (t1.a < 2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a > 1) OR (t1.c < 3) @@ -3839,8 +3839,8 @@ FROM t1 WHERE (t1.a = 1) OR (t1.a = 3) GROUP BY t1.a HAVING (t1.a = 2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain format=json SELECT t1.a,MAX(t1.b) FROM t1 WHERE (t1.a = 1) OR (t1.a = 3) @@ -3890,8 +3890,8 @@ FROM t1 WHERE (t1.a > 1) GROUP BY t1.a HAVING (t1.a < 4) AND (t1.a > 0); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a > 1) @@ -3965,8 +3965,8 @@ FROM t1 WHERE (t1.a = 1) GROUP BY t1.a HAVING (t1.a < 4) AND (t1.a > 0); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a = 1) @@ -4033,8 +4033,8 @@ FROM t1 WHERE (t1.a > 1) GROUP BY t1.a HAVING (t1.a < 4) OR (t1.a > 0); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a > 1) @@ -4108,8 +4108,8 @@ FROM t1 WHERE (t1.a = 1) GROUP BY t1.a HAVING (t1.a < 4) OR (t1.a > 0); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a = 1) @@ -4176,8 +4176,8 @@ FROM t1 WHERE (t1.a > 1) AND (t1.c < 3) GROUP BY t1.a HAVING (t1.a < 4) AND (t1.c > 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a > 1) AND (t1.c < 3) @@ -4252,8 +4252,8 @@ FROM t1 WHERE (t1.a = 1) AND (t1.c < 3) GROUP BY t1.a,t1.c HAVING (t1.a < 4) AND (t1.c > 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a = 1) AND (t1.c < 3) @@ -4328,8 +4328,8 @@ FROM t1 WHERE (t1.a = 1) AND (t1.c = 3) GROUP BY t1.a,t1.c HAVING (t1.a < 4) AND (t1.c > 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a = 1) AND (t1.c = 3) @@ -4394,8 +4394,8 @@ FROM t3 WHERE (t3.a = 1) AND (t3.d = 1) GROUP BY t3.a,t3.b HAVING (t3.b = 2) AND (t3.d > 0); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 Using where explain format=json SELECT t3.a,t3.b,MAX(t3.c),t3.d FROM t3 WHERE (t3.a = 1) AND (t3.d = 1) @@ -4462,8 +4462,8 @@ FROM t3 WHERE (t3.a = 1) AND (t3.d = 1) GROUP BY t3.a,t3.b,t3.d HAVING (t3.b = 2) AND (t3.d > 0); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 Using where explain format=json SELECT t3.a,t3.b,MAX(t3.c),t3.d FROM t3 WHERE (t3.a = 1) AND (t3.d = 1) @@ -4531,8 +4531,8 @@ FROM t1 WHERE (t1.a > 1) OR (t1.c < 3) GROUP BY t1.a HAVING (t1.a < 4) AND (t1.c > 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a > 1) OR (t1.c < 3) @@ -4613,8 +4613,8 @@ FROM t1 WHERE (t1.a > 1) OR (t1.c < 3) GROUP BY t1.a,t1.c HAVING (t1.a < 4) AND (t1.c > 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a > 1) OR (t1.c < 3) @@ -4692,8 +4692,8 @@ FROM t1 WHERE (t1.a = 1) OR (t1.a = 3) GROUP BY t1.a,t1.c HAVING (t1.a = 4) OR (t1.c > 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a = 1) OR (t1.a = 3) @@ -4768,8 +4768,8 @@ FROM t1 WHERE (t1.a = 1) AND (t1.a = t1.c) GROUP BY t1.a HAVING (t1.c = 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a = 1) AND (t1.a = t1.c) @@ -4833,8 +4833,8 @@ FROM t1 WHERE (t1.a = 1) AND (t1.a = t1.c) GROUP BY t1.a HAVING (t1.c = 1) OR (t1.c = 2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a = 1) AND (t1.a = t1.c) @@ -4897,8 +4897,8 @@ FROM t1 WHERE (t1.a = 1) AND (t1.a = t1.c) GROUP BY t1.a HAVING (t1.c = 3) OR (t1.c = 2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a = 1) AND (t1.a = t1.c) @@ -4945,8 +4945,8 @@ FROM t1 WHERE (t1.a = 1) GROUP BY t1.a,t1.c HAVING (t1.c = 3) AND (t1.a > 2) AND (t1.a = t1.c); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a = 1) @@ -4992,8 +4992,8 @@ FROM t1 WHERE (t1.a = 1) GROUP BY t1.a HAVING (t1.c = 3) AND (t1.a > 2) AND (t1.a = t1.c); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain format=json SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a = 1) @@ -5040,8 +5040,8 @@ FROM t3 WHERE (t3.a > 1) AND ((t3.c = 3) OR (t3.c < 2)) GROUP BY t3.a HAVING (t3.a = t3.d) AND ((t3.d = 1) OR (t3.d > 1)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 Using where; Using temporary; Using filesort explain format=json SELECT t3.a,MAX(t3.b),t3.c,t3.d FROM t3 WHERE (t3.a > 1) AND ((t3.c = 3) OR (t3.c < 2)) @@ -5114,8 +5114,8 @@ FROM t3 WHERE (t3.a > 1) AND ((t3.c = 3) OR (t3.c < 2)) GROUP BY t3.a HAVING (t3.a = t3.d) AND (((t3.d = t3.c) AND (t3.c < 15)) OR (t3.d > 1)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 Using where; Using temporary; Using filesort explain format=json SELECT t3.a,MAX(t3.b),t3.c,t3.d FROM t3 WHERE (t3.a > 1) AND ((t3.c = 3) OR (t3.c < 2)) @@ -5229,8 +5229,8 @@ d1 explain extended select d1 from t1 group by d1 having d1 between (inet_aton('1978-04-27')) and '2018-08-26'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 select `test`.`t1`.`d1` AS `d1` from `test`.`t1` where `test`.`t1`.`d1` between <cache>(inet_aton('1978-04-27')) and <cache>('2018-08-26') group by `test`.`t1`.`d1` having 1 explain format=json select d1 from t1 @@ -5271,8 +5271,8 @@ Warning 1292 Truncated incorrect datetime value: '1' explain extended select d1 from t1 group by d1 having d1 not between 0 AND exp(0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 select `test`.`t1`.`d1` AS `d1` from `test`.`t1` where `test`.`t1`.`d1` not between <cache>(0) and <cache>(exp(0)) group by `test`.`t1`.`d1` having 1 explain format=json select d1 from t1 @@ -5309,40 +5309,40 @@ CREATE TABLE t1 (a INT, b INT, c INT); INSERT INTO t1 VALUES (1,2,1),(3,2,2),(5,6,4),(3,4,1); EXPLAIN SELECT t1.a,MAX(t1.b) FROM t1 WHERE t1.a > 3 GROUP BY t1.a HAVING t1.a = 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE EXPLAIN SELECT t1.a,MAX(t1.b) FROM t1 WHERE t1.a = 3 GROUP BY t1.a HAVING t1.a > 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE EXPLAIN SELECT t1.a,MAX(t1.b) FROM t1 WHERE t1.a > 3 AND t1.a = 3 GROUP BY t1.a ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE EXPLAIN SELECT t1.a,MAX(t1.b) FROM t1 WHERE (t1.a < 2 OR t1.c > 1) GROUP BY t1.a HAVING t1.a = 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where EXPLAIN SELECT t1.a,MAX(t1.b) FROM t1 WHERE t1.a = 3 GROUP BY t1.a HAVING (t1.a < 2 OR t1.a > 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE EXPLAIN SELECT t1.a,MAX(t1.b) FROM t1 WHERE t1.a = 3 AND (t1.a < 2 OR t1.a > 3) GROUP BY t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE EXPLAIN SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE (t1.a < 2 AND t1.c > 1) GROUP BY t1.a HAVING t1.a = 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE EXPLAIN SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE t1.a = 3 GROUP BY t1.a HAVING (t1.a < 2 AND t1.c > 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE EXPLAIN SELECT t1.a,MAX(t1.b),t1.c FROM t1 WHERE t1.a = 3 AND (t1.a < 2 AND t1.b > 3) GROUP BY t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE DROP TABLE t1; # # MDEV-21184: Constant subquery in condition movable to WHERE diff --git a/mysql-test/main/ignored_index.result b/mysql-test/main/ignored_index.result index 84263dddd4d..84d7d68ba12 100644 --- a/mysql-test/main/ignored_index.result +++ b/mysql-test/main/ignored_index.result @@ -41,23 +41,23 @@ test.t1 analyze status OK test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date EXPLAIN SELECT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 5 Using index ALTER TABLE t1 ALTER INDEX a IGNORED; EXPLAIN SELECT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 ALTER TABLE t1 ALTER INDEX a NOT IGNORED; EXPLAIN SELECT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 5 Using index EXPLAIN SELECT a FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 ALTER TABLE t2 ALTER INDEX a NOT IGNORED; EXPLAIN SELECT a FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 5 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 5 NULL 5 Using index DROP TABLE t1, t2; # Test that renaming an index does not change ignorability and vice versa. CREATE TABLE t1 ( @@ -244,12 +244,12 @@ SHOW INDEXES FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored t1 1 a 1 a A NULL NULL NULL YES BTREE YES EXPLAIN SELECT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 ALTER TABLE t1 ALTER INDEX a NOT IGNORED; EXPLAIN SELECT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 4 Using index DROP TABLE t1; # # IGNORED fulltext indexes. @@ -262,8 +262,8 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze Warning Engine-independent statistics are not collected for column 'b' test.t1 analyze status OK EXPLAIN SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ("collections"); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 fulltext a a 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL fulltext a a 0 1 Using where ALTER TABLE t1 ALTER INDEX a IGNORED; EXPLAIN SELECT * FROM t1 WHERE MATCH(a, b) AGAINST ("collections"); ERROR HY000: Can't find FULLTEXT index matching the column list @@ -278,15 +278,15 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 4 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 4 NULL 3 Using index ALTER TABLE t1 ALTER INDEX a IGNORED; SHOW INDEXES FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored t1 1 a 1 a A 3 NULL NULL BTREE YES EXPLAIN SELECT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 DROP TABLE t1; # # IGNORED spatial indexes @@ -298,8 +298,8 @@ SPATIAL KEY key1(g) ); EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range key1 key1 34 NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range key1 key1 34 NULL 8 Using where ALTER TABLE t1 ALTER INDEX key1 IGNORED; SHOW INDEXES FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored @@ -307,8 +307,8 @@ t1 0 PRIMARY 1 fid A 150 NULL NULL BTREE NO t1 1 key1 1 g A NULL 32 NULL SPATIAL YES EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 150 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 150 Using where DROP TABLE t1; CREATE TABLE t1 ( a INT GENERATED ALWAYS AS (1), KEY key1(a)); INSERT INTO t1 VALUES (),(),(); @@ -316,15 +316,15 @@ SHOW INDEXES FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored t1 1 key1 1 a A NULL NULL NULL YES BTREE NO EXPLAIN SELECT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL key1 5 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL key1 5 NULL 3 Using index ALTER TABLE t1 ALTER INDEX key1 IGNORED; SHOW INDEXES FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored t1 1 key1 1 a A NULL NULL NULL YES BTREE YES EXPLAIN SELECT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 DROP TABLE t1; # # Partitioning on keys with an IGNORED index, IGNORED indexes over @@ -359,25 +359,25 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 14 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19 ALL NULL NULL NULL NULL 14 EXPLAIN SELECT b FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 2 NULL 14 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19 index NULL b 2 NULL 14 Using index EXPLAIN SELECT * FROM t1 WHERE a = '04'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p9 ALL NULL NULL NULL NULL 8 Using where ALTER TABLE t1 ALTER INDEX a NOT IGNORED; EXPLAIN SELECT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 2 NULL 14 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19 index NULL a 2 NULL 14 Using index EXPLAIN SELECT * FROM t1 WHERE a = '04'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 2 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p9 ref a a 2 const 2 Using where ALTER TABLE t1 ALTER INDEX b IGNORED; EXPLAIN SELECT b FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 14 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19 ALL NULL NULL NULL NULL 14 DROP TABLE t1; # # Using FORCE INDEX for an IGNORED index @@ -385,8 +385,8 @@ DROP TABLE t1; CREATE TABLE t1(a INT, key k1(a)); INSERT INTO t1 VALUES (1),(2),(3); EXPLAIN SELECT * FROM t1 FORCE INDEX(k1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL k1 5 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL k1 5 NULL 3 Using index ALTER TABLE t1 ALTER INDEX k1 IGNORED; SHOW CREATE TABLE t1; Table Create Table diff --git a/mysql-test/main/in_subq_cond_pushdown.result b/mysql-test/main/in_subq_cond_pushdown.result index f114fc6824e..0f3bee51fb3 100644 --- a/mysql-test/main/in_subq_cond_pushdown.result +++ b/mysql-test/main/in_subq_cond_pushdown.result @@ -40,10 +40,10 @@ a b c d EXPLAIN SELECT * FROM t1 WHERE t1.c<25 AND (t1.a,t1.c) IN (SELECT t2.e,MAX(t2.g) FROM t2 WHERE t2.e<5 GROUP BY t2.e); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE t1.c<25 AND (t1.a,t1.c) IN (SELECT t2.e,MAX(t2.g) FROM t2 WHERE t2.e<5 GROUP BY t2.e); @@ -132,10 +132,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE t1.c>55 AND t1.b<4 AND (t1.a,t1.b,t1.c) IN @@ -233,10 +233,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.c>60 OR t1.c<25) AND (t1.a,t1.b,t1.c) IN @@ -332,10 +332,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE ((t1.c>60 OR t1.c<25) AND t1.b>2) AND (t1.a,t1.b,t1.c) IN @@ -433,10 +433,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE ((t1.a<2 OR t1.d>3) AND t1.b>1) AND (t1.a,t1.b,t1.c) IN @@ -532,10 +532,10 @@ WHERE v1_x>1 GROUP BY v1_x ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 8 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 8 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE t1.c>20 AND (t1.a,t1.c) IN @@ -631,11 +631,11 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t3.y 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 8 Using where +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t3.y 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1,v1 WHERE t1.c>20 AND t1.c=v1_y AND (t1.a,t1.c) IN @@ -747,10 +747,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE t1.a<2 AND (t1.a,t1.c) IN @@ -847,10 +847,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE t1.a>2 AND t1.a<5 AND (t1.a,t1.c) IN @@ -949,10 +949,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.a<2 OR t1.a>=4) AND (t1.a,t1.c) IN @@ -1047,10 +1047,10 @@ WHERE t2.e<5 GROUP BY t2.e,t2.f ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE ((t1.a<2 OR t1.a=5) AND t1.b>3) AND (t1.a,t1.b,t1.c) IN @@ -1145,10 +1145,10 @@ WHERE t2.e<5 GROUP BY t2.e,t2.f ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE ((t1.a<2 OR t1.a=5) AND t1.b>3) AND (t1.a,t1.b,t1.c) IN @@ -1243,10 +1243,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE ((t1.b<3 OR t1.d>2) AND t1.a<2) AND (t1.a,t1.b,t1.c) IN @@ -1341,10 +1341,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 const,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 const,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE t1.d=1 AND t1.a=t1.d AND (t1.a,t1.c) IN @@ -1437,10 +1437,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE t1.d>1 AND t1.a=t1.d AND (t1.a,t1.c) IN @@ -1533,10 +1533,10 @@ WHERE v1_x>1 GROUP BY v1_x ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 8 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 8 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE t1.a<3 AND (t1.a,t1.c) IN @@ -1633,11 +1633,11 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t3.x,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 8 Using where +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t3.x,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1,v1 WHERE t1.a=v1_x AND v1_x<2 AND v1_y>30 AND (t1.a,t1.c) IN @@ -1747,10 +1747,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE ((t1.b<3 OR t1.b=4) AND t1.a<3) AND (t1.a,t1.b,t1.c) IN @@ -1846,10 +1846,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.a+t1.c>41) AND (t1.a,t1.c) IN @@ -1947,10 +1947,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.c-t1.a<35) AND (t1.a,t1.c) IN @@ -2046,10 +2046,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.c*t1.a>100) AND (t1.a,t1.c) IN @@ -2149,10 +2149,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.c/t1.a>30) AND (t1.a,t1.c) IN @@ -2248,10 +2248,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.c BETWEEN 50 AND 100) AND (t1.a,t1.c) IN @@ -2347,10 +2347,10 @@ WHERE t2.e<5 GROUP BY t2.e,t2.f ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.a+t1.b > 5) AND (t1.a,t1.b,t1.c) IN @@ -2445,10 +2445,10 @@ WHERE t2.e<5 GROUP BY t2.e,t2.f ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.a-t1.b > 0) AND (t1.a,t1.b,t1.c) IN @@ -2543,10 +2543,10 @@ WHERE t2.e<5 GROUP BY t2.e,t2.f ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.a*t1.b > 6) AND (t1.a,t1.b,t1.c) IN @@ -2643,10 +2643,10 @@ WHERE t2.e<5 GROUP BY t2.e,t2.f ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.b/t1.a > 2) AND (t1.a,t1.b,t1.c) IN @@ -2747,10 +2747,10 @@ WHERE t2.e<5 GROUP BY t2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.a BETWEEN 1 AND 3) AND (t1.a,t1.c) IN @@ -2848,11 +2848,11 @@ WHERE v2.e<5 GROUP BY v2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 12 Using where; Using temporary -3 DERIVED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE t1.c>3 AND (t1.a,t1.b,t1.c) IN @@ -2972,11 +2972,11 @@ WHERE v2.e<5 GROUP BY v2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 12 Using where; Using temporary -3 DERIVED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE t1.a>1 AND (t1.a,t1.b,t1.c) IN @@ -3096,11 +3096,11 @@ WHERE v2.e<5 GROUP BY v2.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 12 Using where; Using temporary -3 DERIVED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE t1.a>1 AND t1.c<100 AND (t1.a,t1.b,t1.c) IN @@ -3238,11 +3238,11 @@ WHERE d_tab.e<5 GROUP BY d_tab.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 12 Using where; Using temporary -3 DERIVED t2 ALL NULL NULL NULL NULL 12 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 12 Using temporary; Using filesort EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE t1.a>1 AND (t1.a,t1.b,t1.c) IN @@ -3403,11 +3403,11 @@ WHERE d_tab.e<5 GROUP BY d_tab.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 12 Using where; Using temporary -3 DERIVED t2 ALL NULL NULL NULL NULL 12 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 12 Using temporary; Using filesort EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE t1.a>1 AND (t1.a,t1.b,t1.c) IN @@ -3569,11 +3569,11 @@ WHERE d_tab.e<5 GROUP BY d_tab.e ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 12 Using where; Using temporary -3 DERIVED t2 ALL NULL NULL NULL NULL 12 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 12 Using temporary; Using filesort EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE t1.a>1 AND (t1.a,t1.b,t1.c) IN @@ -3716,12 +3716,12 @@ HAVING t2.f<5 GROUP BY t1.a ) AS d_tab WHERE d_tab.a=t3.x AND d_tab.a<5 AND d_tab.max_c<70; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t3.x 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 16 Using where; Using temporary; Using filesort -2 DERIVED <subquery3> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 8 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t3.x 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 16 Using where; Using temporary; Using filesort +2 DERIVED <subquery3> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t3, ( @@ -3901,12 +3901,12 @@ HAVING t2.f<5 GROUP BY t1.a ) AS d_tab WHERE d_tab.a=t3.x AND d_tab.a<5 AND d_tab.max_c<70; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 8 Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t3.x 2 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 16 Using where; Using temporary; Using filesort -2 DERIVED <subquery3> eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 8 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t3.x 2 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 16 Using where; Using temporary; Using filesort +2 DERIVED <subquery3> NULL eq_ref distinct_key distinct_key 12 test.t1.a,test.t1.b,test.t1.c 1 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t3, ( @@ -4048,10 +4048,10 @@ FROM t2 WHERE t2.e<5 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.b,test.t1.c 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.b,test.t1.c 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.b>1) AND (t1.b, t1.c) IN @@ -4152,10 +4152,10 @@ FROM t2 WHERE t2.e<5 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 12 test.t1.b,test.t1.c 1 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 12 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 12 test.t1.b,test.t1.c 1 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE (t1.b>1) AND (t1.b, t1.c) IN diff --git a/mysql-test/main/index_intersect.result b/mysql-test/main/index_intersect.result index 3ec98216479..57a123bb985 100644 --- a/mysql-test/main/index_intersect.result +++ b/mysql-test/main/index_intersect.result @@ -64,23 +64,23 @@ COUNT(*) EXPLAIN SELECT * FROM City WHERE Name LIKE 'C%' AND Population > 1000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 1500000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 300000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Name Name 35 NULL # Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Name Name 35 NULL # Using index condition; Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 7000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where SELECT * FROM City USE INDEX () WHERE Name LIKE 'C%' AND Population > 1000000; ID Name Country Population @@ -364,18 +364,18 @@ COUNT(*) EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'K' AND Population > 1000000 AND Country LIKE 'J%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Population,Country,Name 4,3,35 NULL # Using sort_intersect(Population,Country,Name); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name Population,Country,Name 4,3,35 NULL # Using sort_intersect(Population,Country,Name); Using where EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name,Country Name,Country,Population # NULL # Using sort_intersect(Name,Country,Population); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name,Country Name,Country,Population # NULL # Using sort_intersect(Name,Country,Population); Using where SELECT * FROM City USE INDEX () WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%'; ID Name Country Population @@ -465,30 +465,30 @@ COUNT(*) EXPLAIN SELECT * FROM City WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country Population,PRIMARY,Country 4,4,3 NULL # Using sort_intersect(Population,PRIMARY,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country Population,PRIMARY,Country 4,4,3 NULL # Using sort_intersect(Population,PRIMARY,Country); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 1 AND 500 AND Population > 700000 AND Country LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country Population,PRIMARY,Country 4,4,3 NULL # Using sort_intersect(Population,PRIMARY,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country Population,PRIMARY,Country 4,4,3 NULL # Using sort_intersect(Population,PRIMARY,Country); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'H%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country Country,PRIMARY 3,4 NULL # Using sort_intersect(Country,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country Country,PRIMARY 3,4 NULL # Using sort_intersect(Country,PRIMARY); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3701 AND 4000 AND Population > 1000000 AND Country BETWEEN 'S' AND 'Z'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country Population,PRIMARY 4,4 NULL # Using sort_intersect(Population,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country Population,PRIMARY 4,4 NULL # Using sort_intersect(Population,PRIMARY); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000 AND Country BETWEEN 'S' AND 'Z' ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where SELECT * FROM City USE INDEX () WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%'; ID Name Country Population @@ -699,34 +699,34 @@ SET SESSION sort_buffer_size = IF(@@version_compile_machine like '%64%', 2048, 1 EXPLAIN SELECT * FROM City WHERE Name LIKE 'C%' AND Population > 1000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 1500000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'K' AND Population > 1000000 AND Country LIKE 'J%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Population,Country 4,3 NULL # Using sort_intersect(Population,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name Population,Country 4,3 NULL # Using sort_intersect(Population,Country); Using where EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Country,Name Name 35 NULL # Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Country,Name Name 35 NULL # Using index condition; Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 1 AND 500 AND Population > 700000 AND Country LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000 AND Country BETWEEN 'S' AND 'Z'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where SELECT * FROM City WHERE Name LIKE 'C%' AND Population > 1000000; ID Name Country Population @@ -854,18 +854,18 @@ CREATE INDEX CountryName ON City(Country,Name); EXPLAIN SELECT * FROM City WHERE Country LIKE 'M%' AND Population > 1000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # Using sort_intersect(Population,CountryID); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # Using sort_intersect(Population,CountryID); Using where EXPLAIN SELECT * FROM City WHERE Country='USA' AND Population > 1000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # Using sort_intersect(Population,CountryID); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # Using sort_intersect(Population,CountryID); Using where EXPLAIN SELECT * FROM City WHERE Country='USA' AND Population > 1500000 AND Name LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name,CountryID,CountryName CountryName,Population 38,4 NULL # Using sort_intersect(CountryName,Population); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name,CountryID,CountryName CountryName,Population 38,4 NULL # Using sort_intersect(CountryName,Population); Using where SELECT * FROM City USE INDEX () WHERE Country LIKE 'M%' AND Population > 1000000; ID Name Country Population @@ -936,9 +936,9 @@ EXPLAIN SELECT * FROM City, Country WHERE City.Name LIKE 'C%' AND City.Population > 1000000 AND Country.Code=City.Country; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name,CountryID,CountryName Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name,CountryID,CountryName Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country # DROP DATABASE world; use test; CREATE TABLE t1 ( @@ -965,8 +965,8 @@ INSERT INTO t1 VALUES EXPLAIN SELECT * FROM t1 WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,f4 f4 35 NULL # Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,f4 f4 35 NULL # Using index condition; Using where SELECT * FROM t1 WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ; f1 f4 f5 diff --git a/mysql-test/main/index_intersect.test b/mysql-test/main/index_intersect.test index 26937fd5eef..4a1bf3cc82b 100644 --- a/mysql-test/main/index_intersect.test +++ b/mysql-test/main/index_intersect.test @@ -57,22 +57,22 @@ SELECT COUNT(*) FROM City WHERE Population > 7000000; # we can get either an index intersection retrieval over key1 and key2 # or a range index scan for one of these indexes ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE Name LIKE 'C%' AND Population > 1000000; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 1500000; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 300000; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 7000000; @@ -131,17 +131,17 @@ SELECT COUNT(*) FROM City WHERE Country LIKE 'J%'; # over(key1,key2), over(key1,key3) and over(key2,key3) ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%'; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'K' AND Population > 1000000 AND Country LIKE 'J%'; ---replace_column 7 # 9 # +--replace_column 8 # 10 # --replace_result Population,Country,Name Population,Name,Country EXPLAIN SELECT * FROM City @@ -204,28 +204,28 @@ SELECT COUNT(*) FROM City WHERE Country BETWEEN 'S' AND 'Z'; # tested instance the table City. ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%'; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE ID BETWEEN 1 AND 500 AND Population > 700000 AND Country LIKE 'C%'; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'H%'; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3701 AND 4000 AND Population > 1000000 AND Country BETWEEN 'S' AND 'Z'; ---replace_column 9 # +--replace_column 10 # --replace_result PRIMARY,Country,Population PRIMARY,Population,Country 4,7,4 4,4,7 EXPLAIN SELECT * FROM City @@ -296,34 +296,34 @@ SET SESSION sort_buffer_size = IF(@@version_compile_machine like '%64%', 2048, 1 # may be different if sort_buffer_size is set to a small value ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE Name LIKE 'C%' AND Population > 1000000; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 1500000; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'K' AND Population > 1000000 AND Country LIKE 'J%'; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%'; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE ID BETWEEN 1 AND 500 AND Population > 700000 AND Country LIKE 'C%'; ---replace_column 9 # +--replace_column 10 # --replace_result PRIMARY,Country,Population PRIMARY,Population,Country 4,7,4 4,4,7 EXPLAIN SELECT * FROM City @@ -380,17 +380,17 @@ ANALYZE TABLE City; # index intersection, even in the cases when we have a ref access # for this component ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE Country LIKE 'M%' AND Population > 1000000; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE Country='USA' AND Population > 1000000; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE Country='USA' AND Population > 1500000 AND Name LIKE 'C%'; @@ -426,7 +426,7 @@ SELECT * FROM City # to the choice of a suboptimal execution plan # ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City, Country WHERE City.Name LIKE 'C%' AND City.Population > 1000000 AND @@ -464,7 +464,7 @@ INSERT INTO t1 VALUES (991,'z',0), (992,'M',1), (993,'u',2), (994,'r',2), (995,'b',4), (996,'A',2), (997,'u',0), (998,'a',0), (999,'j',2), (1,'I',2); ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM t1 WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ; diff --git a/mysql-test/main/index_intersect_innodb.result b/mysql-test/main/index_intersect_innodb.result index 44407dbcd30..a9ab36e49eb 100644 --- a/mysql-test/main/index_intersect_innodb.result +++ b/mysql-test/main/index_intersect_innodb.result @@ -70,23 +70,23 @@ COUNT(*) EXPLAIN SELECT * FROM City WHERE Name LIKE 'C%' AND Population > 1000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 1500000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 300000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Name Name 35 NULL # Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Name Name 35 NULL # Using index condition; Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 7000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where SELECT * FROM City USE INDEX () WHERE Name LIKE 'C%' AND Population > 1000000; ID Name Country Population @@ -370,18 +370,18 @@ COUNT(*) EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Population,Name,Country 4,35,3 NULL # Using sort_intersect(Population,Name,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name Population,Name,Country 4,35,3 NULL # Using sort_intersect(Population,Name,Country); Using where EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'K' AND Population > 1000000 AND Country LIKE 'J%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Population,Country,Name 4,3,35 NULL # Using sort_intersect(Population,Country,Name); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name Population,Country,Name 4,3,35 NULL # Using sort_intersect(Population,Country,Name); Using where EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Name,Country Name # NULL # Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Name,Country Name # NULL # Using index condition; Using where SELECT * FROM City USE INDEX () WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%'; ID Name Country Population @@ -471,30 +471,30 @@ COUNT(*) EXPLAIN SELECT * FROM City WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 1 AND 500 AND Population > 700000 AND Country LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'H%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3701 AND 4000 AND Population > 1000000 AND Country BETWEEN 'S' AND 'Z'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000 AND Country BETWEEN 'S' AND 'Z' ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where SELECT * FROM City USE INDEX () WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%'; ID Name Country Population @@ -705,34 +705,34 @@ SET SESSION sort_buffer_size = IF(@@version_compile_machine like '%64%', 2048, 1 EXPLAIN SELECT * FROM City WHERE Name LIKE 'C%' AND Population > 1000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 1500000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'K' AND Population > 1000000 AND Country LIKE 'J%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Population,Country 4,3 NULL # Using sort_intersect(Population,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name Population,Country 4,3 NULL # Using sort_intersect(Population,Country); Using where EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Country,Name Name 35 NULL # Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Country,Name Name 35 NULL # Using index condition; Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 1 AND 500 AND Population > 700000 AND Country LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000 AND Country BETWEEN 'S' AND 'Z'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY,Population,Country PRIMARY 4 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY,Population,Country PRIMARY 4 NULL # Using where SELECT * FROM City WHERE Name LIKE 'C%' AND Population > 1000000; ID Name Country Population @@ -860,18 +860,18 @@ CREATE INDEX CountryName ON City(Country,Name); EXPLAIN SELECT * FROM City WHERE Country LIKE 'M%' AND Population > 1000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # Using sort_intersect(Population,CountryID); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # Using sort_intersect(Population,CountryID); Using where EXPLAIN SELECT * FROM City WHERE Country='USA' AND Population > 1000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # Using sort_intersect(Population,CountryID); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # Using sort_intersect(Population,CountryID); Using where EXPLAIN SELECT * FROM City WHERE Country='USA' AND Population > 1500000 AND Name LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name,CountryID,CountryName CountryName,Population 38,4 NULL # Using sort_intersect(CountryName,Population); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name,CountryID,CountryName CountryName,Population 38,4 NULL # Using sort_intersect(CountryName,Population); Using where SELECT * FROM City USE INDEX () WHERE Country LIKE 'M%' AND Population > 1000000; ID Name Country Population @@ -942,9 +942,9 @@ EXPLAIN SELECT * FROM City, Country WHERE City.Name LIKE 'C%' AND City.Population > 1000000 AND Country.Code=City.Country; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name,CountryID,CountryName Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Name,CountryID,CountryName Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country # DROP DATABASE world; use test; CREATE TABLE t1 ( @@ -971,8 +971,8 @@ INSERT INTO t1 VALUES EXPLAIN SELECT * FROM t1 WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,f4 PRIMARY,f4 4,39 NULL # Using sort_intersect(PRIMARY,f4); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge PRIMARY,f4 PRIMARY,f4 4,39 NULL # Using sort_intersect(PRIMARY,f4); Using where SELECT * FROM t1 WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ; f1 f4 f5 diff --git a/mysql-test/main/index_merge_innodb.result b/mysql-test/main/index_merge_innodb.result index ada2abdc0d6..179eac2fe50 100644 --- a/mysql-test/main/index_merge_innodb.result +++ b/mysql-test/main/index_merge_innodb.result @@ -18,8 +18,8 @@ INDEX i2(key2) ); INSERT INTO t1 SELECT seq,200-seq FROM seq_0_to_200; explain select * from t1 where key1 < 5 or key2 > 197; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where select * from t1 where key1 < 5 or key2 > 197; key1 key2 0 200 @@ -28,8 +28,8 @@ key1 key2 3 197 4 196 explain select * from t1 where key1 < 3 or key2 > 195; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where select * from t1 where key1 < 3 or key2 > 195; key1 key2 0 200 @@ -44,8 +44,8 @@ add str3 char (255) not null; update t1 set str1='aaa', str2='bbb', str3=concat(key2, '-', key1 div 2, '_' ,if(key1 mod 2 = 0, 'a', 'A')); alter table t1 add primary key (str1, zeroval, str2, str3); explain select * from t1 where key1 < 5 or key2 > 197; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where select * from t1 where key1 < 5 or key2 > 197; key1 key2 str1 zeroval str2 str3 4 196 aaa 0 bbb 196-2_a @@ -54,8 +54,8 @@ key1 key2 str1 zeroval str2 str3 1 199 aaa 0 bbb 199-0_A 0 200 aaa 0 bbb 200-0_a explain select * from t1 where key1 < 3 or key2 > 195; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where select * from t1 where key1 < 3 or key2 > 195; key1 key2 str1 zeroval str2 str3 4 196 aaa 0 bbb 196-2_a @@ -77,8 +77,8 @@ Level Code Message INSERT INTO t1 (key1, key2, filler) SELECT seq/4, seq/8, 'filler-data' FROM seq_30_to_0; explain select pk from t1 where key1 = 1 and key2 = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 5,4 NULL 1 Using intersect(key1,key2); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,4 NULL 1 Using intersect(key1,key2); Using where; Using index select pk from t1 where key2 = 1 and key1 = 1; pk 26 @@ -122,16 +122,16 @@ count(*) 5184 explain select count(*) from t1 where key1a = 2 and key1b is null and key2a = 2 and key2b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL REF Using intersect(i1,i2); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 10,10 NULL REF Using intersect(i1,i2); Using where; Using index select count(*) from t1 where key1a = 2 and key1b is null and key2a = 2 and key2b is null; count(*) 4 explain select count(*) from t1 where key1a = 2 and key1b is null and key3a = 2 and key3b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL REF Using intersect(i1,i3); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge i1,i3 i1,i3 10,10 NULL REF Using intersect(i1,i3); Using where; Using index select count(*) from t1 where key1a = 2 and key1b is null and key3a = 2 and key3b is null; count(*) @@ -312,8 +312,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL REF Using sort_union(i3,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge i2,i3 i3,i2 4,4 NULL REF Using sort_union(i3,i2); Using where select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); key1 key2 key3 31 31 31 @@ -347,8 +347,8 @@ EXPLAIN SELECT a FROM t1 WHERE c = 1 AND b = 1 AND d = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c,bd bd 10 const,const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref c,bd bd 10 const,const 2 Using where CREATE TABLE t2 ( a INT ) SELECT a FROM t1 @@ -546,8 +546,8 @@ key (pktail5bad, pk1, pk2, pk2copy), primary key (pk1, pk2) ); explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,key1 PRIMARY 8 NULL 10 Using where select * from t1 where pk1 = 1 and pk2 < 80 and key1=0; pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2 1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2 @@ -561,8 +561,8 @@ pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy b 1 18 0 0 0 0 0 0 0 18 0 filler-data-18 filler2 1 19 0 0 0 0 0 0 0 19 0 filler-data-19 filler2 explain select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where; Using index select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1; pk1 pk2 95 50 @@ -576,35 +576,35 @@ pk1 pk2 95 58 95 59 explain select * from t1 where badkey=1 and key1=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref key1 key1 4 const 100 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref key1 key1 4 const 100 Using where set @tmp_index_merge_ror_cpk=@@optimizer_switch; set optimizer_switch='extended_keys=off'; explain select * from t1 where pk1 < 7500 and key1 = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,key1 key1,PRIMARY 4,4 NULL ROWS Using intersect(key1,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge PRIMARY,key1 key1,PRIMARY 4,4 NULL ROWS Using intersect(key1,PRIMARY); Using where set optimizer_switch=@tmp_index_merge_ror_cpk; explain select * from t1 where pktail1ok=1 and key1=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,pktail1ok key1,pktail1ok 4,4 NULL 1 Using intersect(key1,pktail1ok); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,pktail1ok key1,pktail1ok 4,4 NULL 1 Using intersect(key1,pktail1ok); Using where explain select * from t1 where pktail2ok=1 and key1=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,pktail2ok key1,pktail2ok 4,4 NULL 1 Using intersect(key1,pktail2ok); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,pktail2ok key1,pktail2ok 4,4 NULL 1 Using intersect(key1,pktail2ok); Using where explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 200 Using sort_union(pktail2ok,key1); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 200 Using sort_union(pktail2ok,key1); Using where explain select * from t1 where pktail3bad=1 and key1=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref key1,pktail3bad key1 4 const 100 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref key1,pktail3bad key1 4 const 100 Using where explain select * from t1 where pktail4bad=1 and key1=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref key1,pktail4bad key1 4 const 100 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref key1,pktail4bad key1 4 const 100 Using where explain select * from t1 where pktail5bad=1 and key1=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref key1,pktail5bad key1 4 const 100 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref key1,pktail5bad key1 4 const 100 Using where explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where; Using index select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10; pk1 pk2 key1 key2 95 50 10 10 @@ -653,9 +653,9 @@ f1 2 EXPLAIN SELECT t1.f1 FROM t1 WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using index -2 SUBQUERY t2 index_merge f2,f3 f3,f2 2,5 NULL 1 Using intersect(f3,f2); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +2 SUBQUERY t2 NULL index_merge f2,f3 f3,f2 2,5 NULL 1 Using intersect(f3,f2); Using where; Using index DROP TABLE t1,t2; # # BUG#56862/640419: Wrong result with sort_union index merge when one @@ -688,9 +688,9 @@ EXPLAIN SELECT COUNT(*) FROM (SELECT * FROM t1 FORCE INDEX(primary,idx) WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL # -2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL # Using sort_union(idx,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL # +2 DERIVED t1 NULL index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL # Using sort_union(idx,PRIMARY); Using where SELECT COUNT(*) FROM (SELECT * FROM t1 FORCE INDEX(primary,idx) WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; @@ -700,9 +700,9 @@ EXPLAIN SELECT COUNT(*) FROM (SELECT * FROM t1 IGNORE INDEX(idx) WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL # -2 DERIVED t1 ALL PRIMARY NULL NULL NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL # +2 DERIVED t1 NULL ALL PRIMARY NULL NULL NULL # Using where SELECT COUNT(*) FROM (SELECT * FROM t1 IGNORE INDEX(idx) WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; @@ -738,8 +738,8 @@ EXPLAIN SELECT v2 FROM t1 WHERE v1 IN ('f', 'd', 'h', 'u' ) AND i = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref i,v i 5 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref i,v i 5 const 2 Using where DROP TABLE t1; # # BUG#1006164: Multi-table DELETE that uses innodb + index_merge/intersect may fail to delete rows @@ -826,8 +826,8 @@ INDEX (b) ) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC; INSERT INTO t1 SELECT seq, seq, seq from seq_1_to_100; EXPLAIN SELECT * FROM t1 WHERE a='1' OR b < 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,b b,PRIMARY 5,3074 NULL 5 Using sort_union(b,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge PRIMARY,b b,PRIMARY 5,3074 NULL 5 Using sort_union(b,PRIMARY); Using where SELECT * FROM t1 WHERE a='1' OR b < 5; a b c 2 2 2 diff --git a/mysql-test/main/index_merge_innodb.test b/mysql-test/main/index_merge_innodb.test index e8ebb6b2a64..342863870ba 100644 --- a/mysql-test/main/index_merge_innodb.test +++ b/mysql-test/main/index_merge_innodb.test @@ -77,7 +77,7 @@ set optimizer_switch='derived_merge=off,derived_with_keys=off'; # We have to use FORCE INDEX here as Innodb gives inconsistent estimates # which causes different query plans. ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT COUNT(*) FROM (SELECT * FROM t1 FORCE INDEX(primary,idx) @@ -86,7 +86,7 @@ SELECT COUNT(*) FROM (SELECT * FROM t1 FORCE INDEX(primary,idx) WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT COUNT(*) FROM (SELECT * FROM t1 IGNORE INDEX(idx) diff --git a/mysql-test/main/index_merge_myisam.result b/mysql-test/main/index_merge_myisam.result index 846d73c58d7..e4cd8b769ca 100644 --- a/mysql-test/main/index_merge_myisam.result +++ b/mysql-test/main/index_merge_myisam.result @@ -22,12 +22,12 @@ Table Op Msg_type Msg_text test.t0 analyze status Engine-independent statistics collected test.t0 analyze status OK explain select * from t0 where key1 < 3 or key1 > 920 and key1 < 924; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 range i1 i1 4 NULL 5 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL range i1 i1 4 NULL 5 Using index condition explain select * from t0 where key1 < 3 or key2 > 920 and key2 < 924; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 5 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 5 Using sort_union(i1,i2); Using where select * from t0 where key1 < 3 or key2 > 920 and key2 < 924; key1 key2 key3 key4 key5 key6 key7 key8 1 1 1 1 1 1 1 1023 @@ -39,12 +39,12 @@ select * from t0 where key1=1022; key1 key2 key3 key4 key5 key6 key7 key8 1022 1022 1022 1022 1022 1022 1022 2 explain select * from t0 where key1 < 3 or key2 <4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 5 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 5 Using sort_union(i1,i2); Using where explain select * from t0 where (key1 > 30 and key1<35) or (key2 >32 and key2 < 40); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 11 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 11 Using sort_union(i1,i2); Using where select * from t0 where (key1 > 30 and key1<35) or (key2 >32 and key2 < 40); key1 key2 key3 key4 key5 key6 key7 key8 31 31 31 31 31 31 31 993 @@ -57,56 +57,56 @@ key1 key2 key3 key4 key5 key6 key7 key8 38 38 38 38 38 38 38 986 39 39 39 39 39 39 39 985 explain select * from t0 ignore index (i2) where key1 < 3 or key2 <4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL i1 NULL NULL NULL 1024 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL i1 NULL NULL NULL 1024 Using where explain select * from t0 where (key1 < 3 or key2 <4) and key3 = 50; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ref i1,i2,i3 i3 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ref i1,i2,i3 i3 4 const 1 Using where explain select * from t0 use index (i1,i2) where (key1 < 3 or key2 <4) and key3 = 50; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 5 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 5 Using sort_union(i1,i2); Using where explain select * from t0 where (key1 > 1 or key2 > 2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL i1,i2 NULL NULL NULL 1024 Using where explain select * from t0 force index (i1,i2) where (key1 > 1 or key2 > 2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 1024 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 1024 Using sort_union(i1,i2); Using where explain select * from t0 where key1<3 or key2<3 or (key1>5 and key1<8) or (key1>10 and key1<12) or (key2>100 and key2<110); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 15 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 15 Using sort_union(i1,i2); Using where explain select * from t0 where key2 = 45 or key1 <=> null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 range i1,i2 i2 4 NULL 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL range i1,i2 i2 4 NULL 1 Using index condition explain select * from t0 where key2 = 45 or key1 is not null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL i1,i2 NULL NULL NULL 1024 Using where explain select * from t0 where key2 = 45 or key1 is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ref i2 i2 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ref i2 i2 4 const 1 explain select * from t0 where key2=10 or key3=3 or key4 <=> null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i2,i3,i4 i2,i3 4,4 NULL 2 Using union(i2,i3); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i2,i3,i4 i2,i3 4,4 NULL 2 Using union(i2,i3); Using where explain select * from t0 where key2=10 or key3=3 or key4 is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i2,i3 i2,i3 4,4 NULL 2 Using union(i2,i3); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i2,i3 i2,i3 4,4 NULL 2 Using union(i2,i3); Using where explain select key1 from t0 where (key1 <=> null) or (key2 < 5) or (key3=10) or (key4 <=> null); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3,i4 i2,i3 4,4 NULL 5 Using sort_union(i2,i3); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i4 i2,i3 4,4 NULL 5 Using sort_union(i2,i3); Using where explain select key1 from t0 where (key1 <=> null) or (key1 < 5) or (key3=10) or (key4 <=> null); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i3,i4 i1,i3 4,4 NULL 5 Using sort_union(i1,i3); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i3,i4 i1,i3 4,4 NULL 5 Using sort_union(i1,i3); Using where explain select * from t0 where (key1 < 3 or key2 < 3) and (key3 < 4 or key4 < 4) and (key5 < 5 or key6 < 5); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3,i4,i5,i6 i1,i2 4,4 NULL 4 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i4,i5,i6 i1,i2 4,4 NULL 4 Using sort_union(i1,i2); Using where explain select * from t0 where (key1 < 3 or key2 < 6) and (key1 < 7 or key3 < 4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL 7 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3 i1,i2 4,4 NULL 7 Using sort_union(i1,i2); Using where select * from t0 where (key1 < 3 or key2 < 6) and (key1 < 7 or key3 < 4); key1 key2 key3 key4 key5 key6 key7 key8 1 1 1 1 1 1 1 1023 @@ -116,28 +116,28 @@ key1 key2 key3 key4 key5 key6 key7 key8 5 5 5 5 5 5 5 1019 explain select * from t0 where (key1 < 3 or key2 < 3) and (key3 < 4 or key4 < 4) and (key5 < 2 or key6 < 2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3,i4,i5,i6 i5,i6 4,4 NULL 2 Using sort_union(i5,i6); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i4,i5,i6 i5,i6 4,4 NULL 2 Using sort_union(i5,i6); Using where explain select * from t0 where (key1 < 3 or key2 < 3) and (key3 < 100); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL 4 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3 i1,i2 4,4 NULL 4 Using sort_union(i1,i2); Using where explain select * from t0 where (key1 < 3 or key2 < 3) and (key3 < 1000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL 4 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3 i1,i2 4,4 NULL 4 Using sort_union(i1,i2); Using where explain select * from t0 where ((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4)) or key2 > 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL i1,i2,i3 NULL NULL NULL 1024 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL i1,i2,i3 NULL NULL NULL 1024 Using where explain select * from t0 where ((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4)) or key1 < 7; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where select * from t0 where ((key1 < 4 or key2 < 4) and (key2 <5 or key3 < 4)) or @@ -159,50 +159,50 @@ explain select * from t0 where ((key1 < 4 or key2 < 4) and (key3 <5 or key5 < 4)) or ((key5 < 5 or key6 < 6) and (key7 <7 or key8 < 4)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3,i5,i6,i7,i8 i1,i2,i5,i6 4,4,4,4 NULL 15 Using sort_union(i1,i2,i5,i6); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i5,i6,i7,i8 i1,i2,i5,i6 4,4,4,4 NULL 15 Using sort_union(i1,i2,i5,i6); Using where explain select * from t0 where ((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4)) or ((key7 <7 or key8 < 4) and (key5 < 5 or key6 < 6)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3,i5,i6,i7,i8 i3,i5,i7,i8 4,4,4,4 NULL 16 Using sort_union(i3,i5,i7,i8); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i5,i6,i7,i8 i3,i5,i7,i8 4,4,4,4 NULL 16 Using sort_union(i3,i5,i7,i8); Using where explain select * from t0 where ((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4)) or ((key3 <7 or key5 < 2) and (key5 < 5 or key6 < 6)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3,i5,i6 i3,i5 4,4 NULL 9 Using sort_union(i3,i5); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i5,i6 i3,i5 4,4 NULL 9 Using sort_union(i3,i5); Using where explain select * from t0 where ((key3 <5 or key5 < 4) and (key1 < 4 or key2 < 4)) or (((key3 <7 and key7 < 6) or key5 < 2) and (key5 < 5 or key6 < 6)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3,i5,i6,i7 i3,i5 4,4 NULL 9 Using sort_union(i3,i5); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i5,i6,i7 i3,i5 4,4 NULL 9 Using sort_union(i3,i5); Using where explain select * from t0 where ((key3 < 4 or key5 < 4) and (key1 < 4 or key2 < 4)) or ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where ((key3 < 4 or key5 < 4) and (key1 < 4 or key2 < 4)) or ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3,i5,i6 i3,i5 4,4 NULL 1024 Using sort_union(i3,i5); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i5,i6 i3,i5 4,4 NULL 1024 Using sort_union(i3,i5); Using where explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where ((key3 < 5 or key5 < 4) and (key1 < 4 or key2 < 4)) or ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where explain select * from t0 force index(i1, i2, i3, i4, i5, i6 ) where ((key3 < 10 or key5 < 4) and (key1 < 4 or key2 < 4)) or ((key3 >=5 or key5 < 2) and (key5 < 5 or key6 < 6)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 Using where select * from t0 where key1 < 5 or key8 < 4 order by key1; key1 key2 key3 key4 key5 key6 key7 key8 1 1 1 1 1 1 1 1023 @@ -215,8 +215,8 @@ key1 key2 key3 key4 key5 key6 key7 key8 1024 1024 1024 1024 1024 1024 1024 0 explain select * from t0 where key1 < 5 or key8 < 4 order by key1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i8 i1,i8 4,4 NULL 7 Using sort_union(i1,i8); Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i8 i1,i8 4,4 NULL 7 Using sort_union(i1,i8); Using where; Using filesort create table t2 like t0; insert into t2 select * from t0; alter table t2 add index i1_3(key1, key3); @@ -225,14 +225,14 @@ alter table t2 drop index i1; alter table t2 drop index i2; alter table t2 add index i321(key3, key2, key1); explain select key3 from t2 where key1 = 100 or key2 = 100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index_merge i1_3,i2_3 i1_3,i2_3 4,4 NULL 2 Using sort_union(i1_3,i2_3); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index_merge i1_3,i2_3 i1_3,i2_3 4,4 NULL 2 Using sort_union(i1_3,i2_3); Using where explain select key3 from t2 where key1 < 600 or key2 < 600; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index i1_3,i2_3 i321 12 NULL 1024 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index i1_3,i2_3 i321 12 NULL 1024 Using where; Using index explain select key7 from t2 where key1 <100 or key2 < 100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index_merge i1_3,i2_3 i1_3,i2_3 4,4 NULL 186 Using sort_union(i1_3,i2_3); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index_merge i1_3,i2_3 i1_3,i2_3 4,4 NULL 186 Using sort_union(i1_3,i2_3); Using where create table t4 ( key1a int not null, key1b int not null, @@ -253,24 +253,24 @@ key1a key1b key2 key2_1 key2_2 key3 3 3 0 3 3 3 4 4 0 4 4 4 explain select * from t4 where key1a = 3 or key1b = 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 index_merge i1a,i1b i1a,i1b 4,4 NULL 2 Using sort_union(i1a,i1b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL index_merge i1a,i1b i1a,i1b 4,4 NULL 2 Using sort_union(i1a,i1b); Using where explain select * from t4 where key2 = 1 and (key2_1 = 1 or key3 = 5); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ref i2_1,i2_2 i2_1 4 const 9 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ref i2_1,i2_2 i2_1 4 const 9 Using where explain select * from t4 where key2 = 1 and (key2_1 = 1 or key2_2 = 5); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ref i2_1,i2_2 i2_1 4 const 9 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ref i2_1,i2_2 i2_1 4 const 9 Using where explain select * from t4 where key2_1 = 1 or key2_2 = 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 1024 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 1024 Using where create table t1 like t0; insert into t1 select * from t0; explain select * from t0 left join t1 on (t0.key1=t1.key1) where t0.key1=3 or t0.key2=4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where -1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where +1 SIMPLE t1 NULL ref i1 i1 4 test.t0.key1 1 select * from t0 left join t1 on (t0.key1=t1.key1) where t0.key1=3 or t0.key2=4; key1 key2 key3 key4 key5 key6 key7 key8 key1 key2 key3 key4 key5 key6 key7 key8 @@ -278,43 +278,43 @@ key1 key2 key3 key4 key5 key6 key7 key8 key1 key2 key3 key4 key5 key6 key7 key8 4 4 4 4 4 4 4 1020 4 4 4 4 4 4 4 1020 explain select * from t0,t1 where (t0.key1=t1.key1) and ( t0.key1=3 or t0.key2=4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where -1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where +1 SIMPLE t1 NULL ref i1 i1 4 test.t0.key1 1 explain select * from t0,t1 where (t0.key1=t1.key1) and (t0.key1=3 or t0.key2=4) and t1.key1<200; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where -1 SIMPLE t1 ref i1 i1 4 test.t0.key1 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where +1 SIMPLE t1 NULL ref i1 i1 4 test.t0.key1 1 explain select * from t0,t1 where (t0.key1=t1.key1) and (t0.key1=3 or t0.key2<4) and t1.key1=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ref i1,i2 i1 4 const 1 Using where -1 SIMPLE t1 ref i1 i1 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ref i1,i2 i1 4 const 1 Using where +1 SIMPLE t1 NULL ref i1 i1 4 const 1 explain select * from t0,t1 where t0.key1 = 5 and (t1.key1 = t0.key1 or t1.key8 = t0.key1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ref i1 i1 4 const 1 -1 SIMPLE t1 index_merge i1,i8 i1,i8 4,4 NULL 2 Using union(i1,i8); Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ref i1 i1 4 const 1 +1 SIMPLE t1 NULL index_merge i1,i8 i1,i8 4,4 NULL 2 Using union(i1,i8); Using where; Using join buffer (flat, BNL join) explain select * from t0,t1 where t0.key1 < 3 and (t1.key1 = t0.key1 or t1.key8 = t0.key1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 range i1 i1 4 NULL 2 Using index condition -1 SIMPLE t1 ALL i1,i8 NULL NULL NULL 1024 Range checked for each record (index map: 0x81) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL range i1 i1 4 NULL 2 Using index condition +1 SIMPLE t1 NULL ALL i1,i8 NULL NULL NULL 1024 Range checked for each record (index map: 0x81) explain select * from t1 where key1=3 or key2=4 union select * from t1 where key1<4 or key3=5; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where -2 UNION t1 index_merge i1,i3 i1,i3 4,4 NULL 4 Using sort_union(i1,i3); Using where -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where +2 UNION t1 NULL index_merge i1,i3 i1,i3 4,4 NULL 4 Using sort_union(i1,i3); Using where +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; explain select * from (select * from t1 where key1 = 3 or key2 =3) as Z where key8 >5; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where -2 DERIVED t1 index_merge i1,i2,i8 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 Using where +2 DERIVED t1 NULL index_merge i1,i2,i8 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where set optimizer_switch=@tmp_optimizer_switch; create table t3 like t0; insert into t3 select * from t0; @@ -327,8 +327,8 @@ explain select * from t3 where key1=1 or key2=2 or key3=3 or key4=4 or key5=5 or key6=6 or key7=7 or key8=8 or key9=9 or keyA=10 or keyB=11 or keyC=12; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index_merge i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC 4,4,4,4,4,4,4,4,4,4,4,4 NULL 12 Using union(i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL index_merge i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC 4,4,4,4,4,4,4,4,4,4,4,4 NULL 12 Using union(i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC); Using where select * from t3 where key1=1 or key2=2 or key3=3 or key4=4 or key5=5 or key6=6 or key7=7 or key8=8 or @@ -347,8 +347,8 @@ key1 key2 key3 key4 key5 key6 key7 key8 key9 keyA keyB keyC 12 12 12 12 12 12 12 1012 12 12 12 12 1016 1016 1016 1016 1016 1016 1016 8 1016 1016 1016 1016 explain select * from t0 where key1 < 3 or key2 < 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 5 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 5 Using sort_union(i1,i2); Using where select * from t0 where key1 < 3 or key2 < 4; key1 key2 key3 key4 key5 key6 key7 key8 1 1 1 1 1 1 1 1023 @@ -375,9 +375,9 @@ explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 from t0 as A force index(i1,i2), t0 as B force index (i1,i2) where (A.key1 < 500000 or A.key2 < 3) and (B.key1 < 500000 or B.key2 < 3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A index_merge i1,i2 i1,i2 4,4 NULL 1010 Using sort_union(i1,i2); Using where -1 SIMPLE B index_merge i1,i2 i1,i2 4,4 NULL 1010 Using sort_union(i1,i2); Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL index_merge i1,i2 i1,i2 4,4 NULL 1010 Using sort_union(i1,i2); Using where +1 SIMPLE B NULL index_merge i1,i2 i1,i2 4,4 NULL 1010 Using sort_union(i1,i2); Using where; Using join buffer (flat, BNL join) select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) from t0 as A force index(i1,i2), t0 as B force index (i1,i2) where (A.key1 < 500000 or A.key2 < 3) @@ -389,9 +389,9 @@ explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 from t0 as A force index(i1,i2), t0 as B force index (i1,i2) where (A.key1 = 1 or A.key2 = 1) and (B.key1 = 1 or B.key2 = 1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A index_merge i1,i2 i1,i2 4,4 NULL 1021 Using union(i1,i2); Using where -1 SIMPLE B index_merge i1,i2 i1,i2 4,4 NULL 1021 Using union(i1,i2); Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL index_merge i1,i2 i1,i2 4,4 NULL 1021 Using union(i1,i2); Using where +1 SIMPLE B NULL index_merge i1,i2 i1,i2 4,4 NULL 1021 Using union(i1,i2); Using where; Using join buffer (flat, BNL join) select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) from t0 as A force index(i1,i2), t0 as B force index (i1,i2) where (A.key1 = 1 or A.key2 = 1) @@ -404,9 +404,9 @@ explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 from t0 as A straight_join t0 as B where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1) and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where -1 SIMPLE B index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where +1 SIMPLE B NULL index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # Using union(intersect(i2,i3,i4,i5,i6,i7?),i8); Using where; Using join buffer (flat, BNL join) select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) from t0 as A straight_join t0 as B where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1) @@ -427,11 +427,11 @@ select count(*) from t1; count(*) 8704 explain select * from t1 WHERE cola = 'foo' AND colb = 'bar'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 32 Using intersect(cola,colb); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge cola,colb cola,colb 3,3 NULL 32 Using intersect(cola,colb); Using where explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 32 Using intersect(cola,colb); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge cola,colb cola,colb 3,3 NULL 32 Using intersect(cola,colb); Using where drop table t1; create table t1 ( a int, b int, @@ -446,11 +446,11 @@ filler1 char(200), filler2 char(200), key(a),key(b) ) engine=merge union=(t1,t2); explain select * from t1 where a=1 and b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL # Using intersect(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL # Using intersect(a,b); Using where explain select * from t3 where a=1 and b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index_merge a,b a,b 5,5 NULL # Using intersect(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL index_merge a,b a,b 5,5 NULL # Using intersect(a,b); Using where drop table t1, t2, t3; CREATE TABLE t1(a INT); INSERT INTO t1 VALUES(1); @@ -510,8 +510,8 @@ KEY USING BTREE (`b`) insert into t2 select * from t1; must use sort-union rather than union: explain select * from t1 where a=4 or b=4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL # Using sort_union(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL # Using sort_union(a,b); Using where select * from t1 where a=4 or b=4; a filler b 4 4 0 @@ -532,8 +532,8 @@ a filler b 5 qq 4 must use union, not sort-union: explain select * from t2 where a=2 or b=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index_merge a,b a,b 5,5 NULL # Using union(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index_merge a,b a,b 5,5 NULL # Using union(a,b); Using where select * from t2 where a=2 or b=2; a filler b 2 filler 2 @@ -563,11 +563,11 @@ The plan should be ALL/ALL/ALL(Range checked for each record (index map: 0x3) explain select * from t1 where exists (select 1 from t2, t3 where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 -2 MATERIALIZED t3 ALL a,b NULL NULL NULL 1002 Range checked for each record (index map: 0x3) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED t3 NULL ALL a,b NULL NULL NULL 1002 Range checked for each record (index map: 0x3) select * from t1 where exists (select 1 from t2, t3 where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); @@ -585,8 +585,8 @@ SET SESSION sort_buffer_size=1024*8; EXPLAIN SELECT * FROM t1 FORCE INDEX(a,b) WHERE a LIKE 'a%' OR b LIKE 'b%' ORDER BY a,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 131,131 NULL 64 Using sort_union(a,b); Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 131,131 NULL 64 Using sort_union(a,b); Using where; Using filesort SELECT * FROM t1 FORCE INDEX(a,b) WHERE a LIKE 'a%' OR b LIKE 'b%' ORDER BY a,b; SET SESSION sort_buffer_size=DEFAULT; @@ -638,59 +638,59 @@ select count(*) from t1; count(*) 64801 explain select key1,key2 from t1 where key1=100 and key2=100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where; Using index select key1,key2 from t1 where key1=100 and key2=100; key1 key2 100 100 explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; key1 key2 key3 key4 filler1 100 100 100 100 key1-key2-key3-key4 insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, -1, -1, 'key1-key2'); insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 100, 100, 'key4-key3'); explain select key1,key2,filler1 from t1 where key1=100 and key2=100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where select key1,key2,filler1 from t1 where key1=100 and key2=100; key1 key2 filler1 100 100 key1-key2-key3-key4 100 100 key1-key2 explain select key1,key2 from t1 where key1=100 and key2=100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where; Using index select key1,key2 from t1 where key1=100 and key2=100; key1 key2 100 100 100 100 explain select key1,key2,key3,key4 from t1 where key1=100 and key2=100 or key3=100 and key4=100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where select key1,key2,key3,key4 from t1 where key1=100 and key2=100 or key3=100 and key4=100; key1 key2 key3 key4 100 100 100 100 100 100 -1 -1 -1 -1 100 100 explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; key1 key2 key3 key4 filler1 100 100 100 100 key1-key2-key3-key4 100 100 -1 -1 key1-key2 -1 -1 100 100 key4-key3 explain select key1,key2,key3 from t1 where key1=100 and key2=100 and key3=100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 2 Using intersect(key1,key2,key3); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 2 Using intersect(key1,key2,key3); Using where; Using index select key1,key2,key3 from t1 where key1=100 and key2=100 and key3=100; key1 key2 key3 100 100 100 insert into t1 (key1,key2,key3,key4,filler1) values (101,101,101,101, 'key1234-101'); explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=101; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 83 Using union(intersect(key1,key2),key3); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 83 Using union(intersect(key1,key2),key3); Using where select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=101; key1 key2 key3 key4 filler1 100 100 100 100 key1-key2-key3-key4 @@ -706,28 +706,28 @@ delete from t1 where key1=200 and key2=200; select key1,key2,filler1 from t1 where key2=100 and key2=200; key1 key2 filler1 explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; key1 key2 key3 key4 filler1 -1 -1 100 100 key4-key3 delete from t1 where key3=100 and key4=100; explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; key1 key2 key3 key4 filler1 explain select key1,key2 from t1 where key1=100 and key2=100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,5 NULL 77 Using intersect(key1,key2); Using where; Using index select key1,key2 from t1 where key1=100 and key2=100; key1 key2 insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-1'); insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-2'); insert into t1 (key1, key2, key3, key4, filler1) values (100, 100, 200, 200,'key1-key2-key3-key4-3'); explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 137 Using union(key3,intersect(key1,key2),key4); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 137 Using union(key3,intersect(key1,key2),key4); Using where select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200; key1 key2 key3 key4 filler1 100 100 200 200 key1-key2-key3-key4-3 @@ -735,8 +735,8 @@ key1 key2 key3 key4 filler1 100 100 200 200 key1-key2-key3-key4-1 insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, -1, 200,'key4'); explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 148 Using union(key3,intersect(key1,key2),key4); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 148 Using union(key3,intersect(key1,key2),key4); Using where select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200; key1 key2 key3 key4 filler1 100 100 200 200 key1-key2-key3-key4-3 @@ -745,8 +745,8 @@ key1 key2 key3 key4 filler1 -1 -1 -1 200 key4 insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 200, -1,'key3'); explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 159 Using union(key3,intersect(key1,key2),key4); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 159 Using union(key3,intersect(key1,key2),key4); Using where select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200; key1 key2 key3 key4 filler1 100 100 200 200 key1-key2-key3-key4-3 @@ -755,51 +755,51 @@ key1 key2 key3 key4 filler1 -1 -1 -1 200 key4 -1 -1 200 -1 key3 explain select * from t1 where st_a=1 and st_b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b st_a,st_b 4,4 NULL 3515 Using intersect(st_a,st_b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b st_a,st_b 4,4 NULL 3515 Using intersect(st_a,st_b); Using where explain select st_a,st_b from t1 where st_a=1 and st_b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b st_a,st_b 4,4 NULL 3515 Using intersect(st_a,st_b); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b st_a,st_b 4,4 NULL 3515 Using intersect(st_a,st_b); Using where; Using index explain select st_a from t1 ignore index (st_a) where st_a=1 and st_b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,stb_swt1a_2b,stb_swt1b,st_b st_b 4 const 15094 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,stb_swt1a_2b,stb_swt1b,st_b st_b 4 const 15094 Using where explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a sta_swt21a 12 const,const,const 971 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a sta_swt21a 12 const,const,const 971 explain select * from t1 where st_b=1 and swt1b=1 and swt2b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref stb_swt1a_2b,stb_swt1b,st_b stb_swt1a_2b 8 const,const 3879 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref stb_swt1a_2b,stb_swt1b,st_b stb_swt1a_2b 8 const,const 3879 Using where explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a,stb_swt1a_2b 12,12 NULL 58 Using intersect(sta_swt12a,stb_swt1a_2b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a,stb_swt1a_2b 12,12 NULL 58 Using intersect(sta_swt12a,stb_swt1a_2b); Using where explain select * from t1 ignore index (sta_swt21a, stb_swt1a_2b) where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,st_a,stb_swt1b,st_b sta_swt12a,stb_swt1b 12,8 NULL 58 Using intersect(sta_swt12a,stb_swt1b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge sta_swt12a,sta_swt1a,sta_swt2a,st_a,stb_swt1b,st_b sta_swt12a,stb_swt1b 12,8 NULL 58 Using intersect(sta_swt12a,stb_swt1b); Using where explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b) where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge sta_swt1a,sta_swt2a,st_a,stb_swt1b,st_b sta_swt1a,sta_swt2a,stb_swt1b 8,8,8 NULL 57 Using intersect(sta_swt1a,sta_swt2a,stb_swt1b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge sta_swt1a,sta_swt2a,st_a,stb_swt1b,st_b sta_swt1a,sta_swt2a,stb_swt1b 8,8,8 NULL 57 Using intersect(sta_swt1a,sta_swt2a,stb_swt1b); Using where explain select * from t1 ignore index (sta_swt21a, sta_swt12a, stb_swt1a_2b, stb_swt1b) where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge sta_swt1a,sta_swt2a,st_a,st_b sta_swt1a,sta_swt2a,st_b 8,8,4 NULL 223 Using intersect(sta_swt1a,sta_swt2a,st_b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge sta_swt1a,sta_swt2a,st_a,st_b sta_swt1a,sta_swt2a,st_b 8,8,4 NULL 223 Using intersect(sta_swt1a,sta_swt2a,st_b); Using where explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a,stb_swt1a_2b 12,12 NULL 58 Using intersect(sta_swt12a,stb_swt1a_2b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a,stb_swt1a_2b 12,12 NULL 58 Using intersect(sta_swt12a,stb_swt1a_2b); Using where explain select * from t1 where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 232 Using intersect(sta_swt1a,stb_swt1b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 232 Using intersect(sta_swt1a,stb_swt1b); Using where explain select st_a from t1 where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 232 Using intersect(sta_swt1a,stb_swt1b); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 232 Using intersect(sta_swt1a,stb_swt1b); Using where; Using index explain select st_a from t1 where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 232 Using intersect(sta_swt1a,stb_swt1b); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt1a,stb_swt1b 8,8 NULL 232 Using intersect(sta_swt1a,stb_swt1b); Using where; Using index drop table t0,t1; create table t2 ( a char(10), @@ -816,8 +816,8 @@ select count(a) from t2 where b='BBBBBBBB'; count(a) 4 expla_or_bin select count(a_or_b) from t2 where a_or_b='AAAAAAAA' a_or_bnd a_or_b='AAAAAAAA'; -id select_type ta_or_ba_or_ble type possia_or_ble_keys key key_len ref rows Extra_or_b -1 SIMPLE t2 ref a_or_b,a_or_b a_or_b 6 const 4 Using where +id select_type ta_or_ba_or_ble pa_or_brtitions type possia_or_ble_keys key key_len ref rows Extra_or_b +1 SIMPLE t2 NULL ref a_or_b,a_or_b a_or_b 6 const 4 Using where select count(a) from t2 where a='AAAAAAAA' and b='AAAAAAAA'; count(a) 4 @@ -826,8 +826,8 @@ count(a) 4 insert into t2 values ('ab', 'ab', 'uh', 'oh'); explain select a from t2 where a='ab'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 6 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref a a 6 const 1 Using where drop table t2; CREATE TABLE t1(c1 INT, c2 INT DEFAULT 0, c3 CHAR(255) DEFAULT '', KEY(c1), KEY(c2), KEY(c3)); @@ -850,8 +850,8 @@ INDEX i2(key2) ); INSERT INTO t1 SELECT seq,200-seq FROM seq_0_to_200; explain select * from t1 where key1 < 5 or key2 > 197; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where select * from t1 where key1 < 5 or key2 > 197; key1 key2 0 200 @@ -860,8 +860,8 @@ key1 key2 3 197 4 196 explain select * from t1 where key1 < 3 or key2 > 195; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where select * from t1 where key1 < 3 or key2 > 195; key1 key2 0 200 @@ -876,8 +876,8 @@ add str3 char (255) not null; update t1 set str1='aaa', str2='bbb', str3=concat(key2, '-', key1 div 2, '_' ,if(key1 mod 2 = 0, 'a', 'A')); alter table t1 add primary key (str1, zeroval, str2, str3); explain select * from t1 where key1 < 5 or key2 > 197; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where select * from t1 where key1 < 5 or key2 > 197; key1 key2 str1 zeroval str2 str3 0 200 aaa 0 bbb 200-0_a @@ -886,8 +886,8 @@ key1 key2 str1 zeroval str2 str3 3 197 aaa 0 bbb 197-1_A 4 196 aaa 0 bbb 196-2_a explain select * from t1 where key1 < 3 or key2 > 195; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where select * from t1 where key1 < 3 or key2 > 195; key1 key2 str1 zeroval str2 str3 0 200 aaa 0 bbb 200-0_a @@ -909,8 +909,8 @@ Level Code Message INSERT INTO t1 (key1, key2, filler) SELECT seq/4, seq/8, 'filler-data' FROM seq_30_to_0; explain select pk from t1 where key1 = 1 and key2 = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref key1,key2 key1 5 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref key1,key2 key1 5 const 4 Using where select pk from t1 where key2 = 1 and key1 = 1; pk 26 @@ -954,16 +954,16 @@ count(*) 5184 explain select count(*) from t1 where key1a = 2 and key1b is null and key2a = 2 and key2b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL REF Using intersect(i1,i2); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 10,10 NULL REF Using intersect(i1,i2); Using where; Using index select count(*) from t1 where key1a = 2 and key1b is null and key2a = 2 and key2b is null; count(*) 4 explain select count(*) from t1 where key1a = 2 and key1b is null and key3a = 2 and key3b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL REF Using intersect(i1,i3); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge i1,i3 i1,i3 10,10 NULL REF Using intersect(i1,i3); Using where; Using index select count(*) from t1 where key1a = 2 and key1b is null and key3a = 2 and key3b is null; count(*) @@ -1144,8 +1144,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL REF Using sort_union(i3,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge i2,i3 i3,i2 4,4 NULL REF Using sort_union(i3,i2); Using where select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); key1 key2 key3 31 31 31 @@ -1179,8 +1179,8 @@ EXPLAIN SELECT a FROM t1 WHERE c = 1 AND b = 1 AND d = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c,bd bd 10 const,const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref c,bd bd 10 const,const 2 Using where CREATE TABLE t2 ( a INT ) SELECT a FROM t1 @@ -1378,8 +1378,8 @@ key (pktail5bad, pk1, pk2, pk2copy), primary key (pk1, pk2) ); explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 7 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,key1 PRIMARY 8 NULL 7 Using index condition; Using where select * from t1 where pk1 = 1 and pk2 < 80 and key1=0; pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2 1 10 0 0 0 0 0 0 0 10 0 filler-data-10 filler2 @@ -1393,8 +1393,8 @@ pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy b 1 18 0 0 0 0 0 0 0 18 0 filler-data-18 filler2 1 19 0 0 0 0 0 0 0 19 0 filler-data-19 filler2 explain select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1; pk1 pk2 95 59 @@ -1408,35 +1408,35 @@ pk1 pk2 95 51 95 50 explain select * from t1 where badkey=1 and key1=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref key1 key1 4 const 91 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref key1 key1 4 const 91 Using where set @tmp_index_merge_ror_cpk=@@optimizer_switch; set optimizer_switch='extended_keys=off'; explain select * from t1 where pk1 < 7500 and key1 = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref PRIMARY,key1 key1 4 const ROWS Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref PRIMARY,key1 key1 4 const ROWS Using where set optimizer_switch=@tmp_index_merge_ror_cpk; explain select * from t1 where pktail1ok=1 and key1=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref key1,pktail1ok pktail1ok 4 const 76 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref key1,pktail1ok pktail1ok 4 const 76 Using where explain select * from t1 where pktail2ok=1 and key1=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref key1,pktail2ok pktail2ok 4 const 82 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref key1,pktail2ok pktail2ok 4 const 82 Using where explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 173 Using sort_union(pktail2ok,key1); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 173 Using sort_union(pktail2ok,key1); Using where explain select * from t1 where pktail3bad=1 and key1=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref key1,pktail3bad pktail3bad 4 const 73 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref key1,pktail3bad pktail3bad 4 const 73 Using where explain select * from t1 where pktail4bad=1 and key1=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref key1,pktail4bad pktail4bad 4 const 82 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref key1,pktail4bad pktail4bad 4 const 82 Using where explain select * from t1 where pktail5bad=1 and key1=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref key1,pktail5bad pktail5bad 4 const 69 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref key1,pktail5bad pktail5bad 4 const 69 Using where explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10; pk1 pk2 key1 key2 104 49 10 10 @@ -1485,9 +1485,9 @@ f1 2 EXPLAIN SELECT t1.f1 FROM t1 WHERE (SELECT COUNT(*) FROM t2 WHERE t2.f3 = 'h' AND t2.f2 = t1.f1) = 0 AND t1.f1 = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 -2 SUBQUERY t2 ref f2,f3 f3 2 const 2 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 +2 SUBQUERY t2 NULL ref f2,f3 f3 2 const 2 Using index condition; Using where DROP TABLE t1,t2; create table t0 (a int); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -1501,50 +1501,50 @@ A.a, from t0 A, t0 B, t0 C; This should use union: explain select * from t1 where a=1 or b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 2 Using union(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 2 Using union(a,b); Using where This should use ALL: set optimizer_switch='default,index_merge=off,rowid_filter=off'; explain select * from t1 where a=1 or b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a,b NULL NULL NULL 1000 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a,b NULL NULL NULL 1000 Using where This should use sort-union: set optimizer_switch='default,index_merge_union=off,rowid_filter=off'; explain select * from t1 where a=1 or b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 2 Using sort_union(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 2 Using sort_union(a,b); Using where This will use sort-union: set optimizer_switch=default; explain select * from t1 where a<1 or b <1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 38 Using sort_union(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 38 Using sort_union(a,b); Using where This should use ALL: set optimizer_switch='default,index_merge_sort_union=off,rowid_filter=off'; explain select * from t1 where a<1 or b <1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a,b NULL NULL NULL 1000 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a,b NULL NULL NULL 1000 Using where This should use ALL: set optimizer_switch='default,index_merge=off,rowid_filter=off'; explain select * from t1 where a<1 or b <1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a,b NULL NULL NULL 1000 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a,b NULL NULL NULL 1000 Using where This will use sort-union: set optimizer_switch='default,index_merge_union=off,rowid_filter=off'; explain select * from t1 where a<1 or b <1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 38 Using sort_union(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 38 Using sort_union(a,b); Using where alter table t1 add d int, add key(d); update t1 set d=a; This will use sort_union: set optimizer_switch=default; explain select * from t1 where (a=3 or b in (1,2)) and (c=3 or d=4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b,c,d a,b 5,5 NULL 3 Using sort_union(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b,c,d a,b 5,5 NULL 3 Using sort_union(a,b); Using where And if we disable sort_union, union: set optimizer_switch='default,index_merge_sort_union=off,rowid_filter=off'; explain select * from t1 where (a=3 or b in (1,2)) and (c=3 or d=4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b,c,d c,d 5,5 NULL 100 Using union(c,d); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b,c,d c,d 5,5 NULL 100 Using union(c,d); Using where drop table t1; create table t1 ( a int, b int, c int, @@ -1557,44 +1557,44 @@ from t0 A, t0 B, t0 C, t0 D where D.a<5; This should be intersect: set optimizer_switch=default; explain select * from t1 where a=10 and b=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where No intersect when index_merge is disabled: set optimizer_switch='default,index_merge=off,rowid_filter=off'; explain select * from t1 where a=10 and b=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a,b a 5 const 49 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a,b a 5 const 49 Using where No intersect if it is disabled: set optimizer_switch='default,index_merge_sort_intersection=off,index_merge_intersection=off,rowid_filter=off'; explain select * from t1 where a=10 and b=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a,b a 5 const 49 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a,b a 5 const 49 Using where Do intersect when union was disabled set optimizer_switch='default,index_merge_union=off,rowid_filter=off'; explain select * from t1 where a=10 and b=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where Do intersect when sort_union was disabled set optimizer_switch='default,index_merge_sort_union=off,rowid_filter=off'; explain select * from t1 where a=10 and b=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where This will use intersection inside a union: set optimizer_switch=default; explain select * from t1 where a=10 and b=10 or c=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b,c a,b,c 5,5,5 NULL 6 Using union(intersect(a,b),c); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b,c a,b,c 5,5,5 NULL 6 Using union(intersect(a,b),c); Using where Should be only union left: set optimizer_switch='default,index_merge_intersection=off,rowid_filter=off'; explain select * from t1 where a=10 and b=10 or c=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b,c a,c 5,5 NULL 54 Using union(a,c); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b,c a,c 5,5 NULL 54 Using union(a,c); Using where This will switch to sort-union (intersection will be gone, too, that's a known limitation: set optimizer_switch='default,index_merge_union=off,rowid_filter=off'; explain select * from t1 where a=10 and b=10 or c=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b,c a,c 5,5 NULL 54 Using sort_union(a,c); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b,c a,c 5,5 NULL 54 Using sort_union(a,c); Using where set optimizer_switch=default; drop table t0, t1; # @@ -1635,8 +1635,8 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX ( PRIMARY, population_rate, area_rate, code ) WHERE pk = 1 OR population_rate = 1 OR ( area_rate IN ( 1,2 ) OR area_rate IS NULL ) AND (population_rate = 25 OR area_rate BETWEEN 2 AND 25 OR code BETWEEN 'MA' AND 'TX'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,code,population_rate,area_rate PRIMARY,population_rate,area_rate,code 4,5,5,3 NULL 2 Using sort_union(PRIMARY,population_rate,area_rate,code); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge PRIMARY,code,population_rate,area_rate PRIMARY,population_rate,area_rate,code 4,5,5,3 NULL 2 Using sort_union(PRIMARY,population_rate,area_rate,code); Using where SELECT * FROM t1 FORCE INDEX ( PRIMARY, population_rate, area_rate, code ) WHERE pk = 1 OR population_rate = 1 OR ( area_rate IN ( 1,2 ) OR area_rate IS NULL ) AND (population_rate = 25 OR area_rate BETWEEN 2 AND 25 OR code BETWEEN 'MA' AND 'TX'); @@ -1701,8 +1701,8 @@ EXPLAIN SELECT * FROM t1 FORCE KEY (PRIMARY , i , c1 , c2) WHERE pk = 255 OR i = 22 OR (pk IN (1 , 136) AND c2 IN ('c' , 'w') AND (c1 NOT BETWEEN 'e' AND 'i' OR c2 > 'g')) OR (pk is not null and (pk <1 or pk>1)) ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY,c1,i,c2 NULL NULL NULL 69 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY,c1,i,c2 NULL NULL NULL 69 Using where DROP TABLE t1; set optimizer_switch= @optimizer_switch_save; # @@ -1731,8 +1731,8 @@ set optimizer_switch='index_merge_union=on'; explain select * from t1 where (( f3 = 1 or f1 = 7 ) and f1 < 10) or (f3 between 2 and 2 and ( f3 = 1 or f4 < 7 )); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 Using union(f3,PRIMARY,f3); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 Using union(f3,PRIMARY,f3); Using where select * from t1 where (( f3 = 1 or f1 = 7 ) and f1 < 10) or (f3 between 2 and 2 and ( f3 = 1 or f4 < 7 )); @@ -1750,8 +1750,8 @@ test.t1 analyze status OK explain select * from t1 where (( f3 = 1 or f1 = 7 ) and f1 < 10) or (f3 between 2 and 2 and ( f3 = 1 or f4 < 7 )); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 13 Using union(f3,PRIMARY,f3); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 13 Using union(f3,PRIMARY,f3); Using where select * from t1 where (( f3 = 1 or f1 = 7 ) and f1 < 10) or (f3 between 2 and 2 and ( f3 = 1 or f4 < 7 )); @@ -1779,17 +1779,17 @@ test.t0 analyze status OK set @optimizer_switch_save=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where -2 DERIVED t0 index_merge i1,i2,i8 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 Using where +2 DERIVED t0 NULL index_merge i1,i2,i8 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5; key1 key2 key3 key8 3 3 3 1021 set optimizer_use_condition_selectivity=2; explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where -2 DERIVED t0 index_merge i1,i2,i8 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 Using where +2 DERIVED t0 NULL index_merge i1,i2,i8 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5; key1 key2 key3 key8 3 3 3 1021 diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result index de9ff8d8e4d..753d4fefa72 100644 --- a/mysql-test/main/information_schema.result +++ b/mysql-test/main/information_schema.result @@ -353,9 +353,9 @@ sub1 explain select a.ROUTINE_NAME from information_schema.ROUTINES a, information_schema.SCHEMATA b where a.ROUTINE_SCHEMA = b.SCHEMA_NAME; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE # ALL NULL NULL NULL NULL NULL -1 SIMPLE # ALL NULL NULL NULL NULL NULL Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE # NULL ALL NULL NULL NULL NULL NULL +1 SIMPLE # NULL ALL NULL NULL NULL NULL NULL Using where; Using join buffer (flat, BNL join) select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a, mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) AND a.ROUTINE_SCHEMA='test' order by 1; ROUTINE_NAME name @@ -431,8 +431,8 @@ performance_schema sys test explain select * from v0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE # ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE # NULL ALL NULL NULL NULL NULL NULL create view v1 (c) as select table_name from information_schema.tables where table_name="v1"; select * from v1; @@ -1430,12 +1430,12 @@ table_type as object_type from information_schema.tables order by object_schema; explain select * from v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tables ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE tables NULL ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases; Using filesort explain select * from (select table_name from information_schema.tables) as a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED tables ALL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED tables NULL ALL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases set optimizer_switch=@tmp_optimizer_switch; drop view v1; create table t1 (f1 int(11)); @@ -1688,28 +1688,28 @@ DROP TABLE server_status; SET GLOBAL event_scheduler=0; explain select table_name from information_schema.views where table_schema='test' and table_name='v1'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE views ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL Using where; Open_frm_only; Scanned 0 databases +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE views NULL ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL Using where; Open_frm_only; Scanned 0 databases explain select * from information_schema.tables; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tables ALL NULL NULL NULL NULL NULL Open_full_table; Scanned all databases +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE tables NULL ALL NULL NULL NULL NULL NULL Open_full_table; Scanned all databases explain select * from information_schema.collations; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE collations ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE collations NULL ALL NULL NULL NULL NULL NULL explain select * from information_schema.tables where table_schema='test' and table_name= 't1'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tables ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL Using where; Open_full_table; Scanned 0 databases +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE tables NULL ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL Using where; Open_full_table; Scanned 0 databases explain select table_name, table_type from information_schema.tables where table_schema='test'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tables ALL NULL TABLE_SCHEMA NULL NULL NULL Using where; Open_frm_only; Scanned 1 database +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE tables NULL ALL NULL TABLE_SCHEMA NULL NULL NULL Using where; Open_frm_only; Scanned 1 database explain select b.table_name from information_schema.tables a, information_schema.columns b where a.table_name='t1' and a.table_schema='test' and b.table_name=a.table_name; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE a ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL Using where; Skip_open_table; Scanned 0 databases -1 SIMPLE b ALL NULL NULL NULL NULL NULL Using where; Open_frm_only; Scanned all databases; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE a NULL ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL Using where; Skip_open_table; Scanned 0 databases +1 SIMPLE b NULL ALL NULL NULL NULL NULL NULL Using where; Open_frm_only; Scanned all databases; Using join buffer (flat, BNL join) SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'mysqltest'; CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH SCHEMA_COMMENT @@ -1788,8 +1788,8 @@ TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE select * from `information_schema`.`VIEWS` where `TABLE_NAME` = NULL; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM explain extended select 1 from information_schema.tables; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE tables ALL NULL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tables NULL ALL NULL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases Warnings: Note 1003 select 1 AS `1` from `information_schema`.`tables` use information_schema; @@ -1832,14 +1832,14 @@ Got one of the listed errors connection default; disconnect conn1; explain select count(*) from information_schema.tables; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tables ALL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE tables NULL ALL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases explain select count(*) from information_schema.columns; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE columns ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE columns NULL ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases explain select count(*) from information_schema.views; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE views ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE views NULL ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases set global init_connect="drop table if exists t1;drop table if exists t1;\ drop table if exists t1;drop table if exists t1;\ drop table if exists t1;drop table if exists t1;\ @@ -2030,23 +2030,23 @@ disconnect con3726_1; disconnect con3726_2; drop tables t1, t3; EXPLAIN SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE KEY_COLUMN_USAGE ALL NULL NULL NULL NULL NULL Open_full_table; Scanned all databases +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE KEY_COLUMN_USAGE NULL ALL NULL NULL NULL NULL NULL Open_full_table; Scanned all databases EXPLAIN SELECT * FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME='t1'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE PARTITIONS ALL NULL TABLE_NAME NULL NULL NULL Using where; Open_full_table; Scanned 1 database +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE PARTITIONS NULL ALL NULL TABLE_NAME NULL NULL NULL Using where; Open_full_table; Scanned 1 database EXPLAIN SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_SCHEMA='test'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE REFERENTIAL_CONSTRAINTS ALL NULL CONSTRAINT_SCHEMA NULL NULL NULL Using where; Open_full_table; Scanned 1 database +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE REFERENTIAL_CONSTRAINTS NULL ALL NULL CONSTRAINT_SCHEMA NULL NULL NULL Using where; Open_full_table; Scanned 1 database EXPLAIN SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_NAME='t1' and TABLE_SCHEMA='test'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE TABLE_CONSTRAINTS ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL Using where; Open_full_table; Scanned 0 databases +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE TABLE_CONSTRAINTS NULL ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL Using where; Open_full_table; Scanned 0 databases EXPLAIN SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE EVENT_OBJECT_SCHEMA='test'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE TRIGGERS ALL NULL EVENT_OBJECT_SCHEMA NULL NULL NULL Using where; Open_frm_only; Scanned 1 database +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE TRIGGERS NULL ALL NULL EVENT_OBJECT_SCHEMA NULL NULL NULL Using where; Open_frm_only; Scanned 1 database create table information_schema.t1 (f1 INT); ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' drop table information_schema.t1; @@ -2230,16 +2230,16 @@ create view v1 as select table_schema, table_name, column_name from information_ explain extended select column_name from v1 where (table_schema = "osm") and (table_name = "test"); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE columns ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL NULL Using where; Open_frm_only; Scanned 0 databases +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE columns NULL ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL NULL Using where; Open_frm_only; Scanned 0 databases Warnings: Note 1003 select `information_schema`.`columns`.`COLUMN_NAME` AS `column_name` from `information_schema`.`columns` where `information_schema`.`columns`.`TABLE_SCHEMA` = 'osm' and `information_schema`.`columns`.`TABLE_NAME` = 'test' explain extended select information_schema.columns.column_name as column_name from information_schema.columns where (information_schema.columns.table_schema = 'osm') and (information_schema.columns.table_name = 'test'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE columns ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL NULL Using where; Open_frm_only; Scanned 0 databases +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE columns NULL ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL NULL Using where; Open_frm_only; Scanned 0 databases Warnings: Note 1003 select `information_schema`.`columns`.`COLUMN_NAME` AS `column_name` from `information_schema`.`columns` where `information_schema`.`columns`.`TABLE_SCHEMA` = 'osm' and `information_schema`.`columns`.`TABLE_NAME` = 'test' drop view v1; diff --git a/mysql-test/main/init_connection_query_cache.result b/mysql-test/main/init_connection_query_cache.result index df27327e93b..54c6dd04ea3 100644 --- a/mysql-test/main/init_connection_query_cache.result +++ b/mysql-test/main/init_connection_query_cache.result @@ -12,8 +12,8 @@ connection con1; # This explain put here to be sure that init connection query # has 'Impossible WHERE'. explain extended select * from test.t1 where 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 connection default; diff --git a/mysql-test/main/innodb_bug878769.result b/mysql-test/main/innodb_bug878769.result index db7ba3d2ee4..c4f471b28ae 100644 --- a/mysql-test/main/innodb_bug878769.result +++ b/mysql-test/main/innodb_bug878769.result @@ -37,9 +37,9 @@ EXPLAIN SELECT t1.col_time_key, t1.col_varchar_key FROM t2 STRAIGHT_JOIN t1 ON t1.col_int_key = t2.col_int_key GROUP BY 1,2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index col_int_key col_int_key 5 NULL 12 Using where; Using index; Using temporary; Using filesort -1 SIMPLE t1 ref col_int_key col_int_key 5 test.t2.col_int_key 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index col_int_key col_int_key 5 NULL 12 Using where; Using index; Using temporary; Using filesort +1 SIMPLE t1 NULL ref col_int_key col_int_key 5 test.t2.col_int_key 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT t1.col_time_key, t1.col_varchar_key FROM t2 STRAIGHT_JOIN t1 ON t1.col_int_key = t2.col_int_key GROUP BY 1,2; diff --git a/mysql-test/main/innodb_ext_key,off.rdiff b/mysql-test/main/innodb_ext_key,off.rdiff index b334d006737..cca1eafc8ad 100644 --- a/mysql-test/main/innodb_ext_key,off.rdiff +++ b/mysql-test/main/innodb_ext_key,off.rdiff @@ -3,9 +3,9 @@ @@ -9,7 +9,7 @@ explain select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01'; - id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 const,const 1 Using index -+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index + id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 const,const 1 Using index ++1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index flush status; select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01'; count(*) @@ -21,9 +21,9 @@ @@ -50,7 +50,7 @@ select count(*) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000; - id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 1 Using where; Using index -+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index + id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 1 Using where; Using index ++1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index flush status; select count(*) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000; @@ -39,9 +39,9 @@ @@ -71,7 +71,7 @@ select l_orderkey, l_linenumber from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000; - id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 3 Using where; Using index -+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index + id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 3 Using where; Using index ++1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index flush status; select l_orderkey, l_linenumber from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000; @@ -57,9 +57,9 @@ @@ -93,7 +93,7 @@ explain select min(l_orderkey) from lineitem where l_shipdate='1992-07-01'; - id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -+1 SIMPLE lineitem ref i_l_shipdate i_l_shipdate 4 const 6 Using index + id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away ++1 SIMPLE lineitem NULL ref i_l_shipdate i_l_shipdate 4 const 6 Using index flush status; select min(l_orderkey) from lineitem where l_shipdate='1992-07-01'; min(l_orderkey) @@ -75,9 +75,9 @@ @@ -113,7 +113,7 @@ select min(l_orderkey) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000; - id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index + id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away ++1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index flush status; select min(l_orderkey) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000; @@ -93,9 +93,9 @@ @@ -134,7 +134,7 @@ select max(l_linenumber) from lineitem where l_shipdate='1992-07-01' and l_orderkey=130; - id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index + id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away ++1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index flush status; select max(l_linenumber) from lineitem where l_shipdate='1992-07-01' and l_orderkey=130; @@ -111,9 +111,9 @@ @@ -157,7 +157,7 @@ where l_shipdate='1992-07-01' and l_orderkey=130 or l_receiptdate='1992-07-01' and l_orderkey=5603; - id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 2 Using union(i_l_shipdate,i_l_receiptdate); Using where -+1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 4,4 NULL 9 Using union(i_l_shipdate,i_l_receiptdate); Using where + id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE lineitem NULL index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 2 Using union(i_l_shipdate,i_l_receiptdate); Using where ++1 SIMPLE lineitem NULL index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 4,4 NULL 9 Using union(i_l_shipdate,i_l_receiptdate); Using where flush status; select l_orderkey, l_linenumber from lineitem use index (i_l_shipdate, i_l_receiptdate) @@ -133,9 +133,9 @@ @@ -183,7 +183,7 @@ where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000 or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000; - id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate # NULL 3 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where -+1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate # NULL 9 Using union(i_l_shipdate,i_l_receiptdate); Using where + id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE lineitem NULL index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate # NULL 3 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where ++1 SIMPLE lineitem NULL index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate # NULL 9 Using union(i_l_shipdate,i_l_receiptdate); Using where flush status; select l_orderkey, l_linenumber from lineitem use index (i_l_shipdate, i_l_receiptdate) @@ -155,9 +155,9 @@ @@ -209,7 +209,7 @@ where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000 or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000; - id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,i_l_receiptdate # NULL # Using -+1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,PRIMARY,i_l_receiptdate,PRIMARY # NULL # Using + id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE lineitem NULL index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,i_l_receiptdate # NULL # Using ++1 SIMPLE lineitem NULL index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,PRIMARY,i_l_receiptdate,PRIMARY # NULL # Using flush status; select l_orderkey, l_linenumber from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000 @@ -170,9 +170,9 @@ explain select max(l_orderkey) from lineitem where l_partkey between 1 and 10 group by l_partkey; - id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE lineitem range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # Using where; Using index for group-by -+1 SIMPLE lineitem range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # Using where; Using index + id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE lineitem NULL range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # Using where; Using index for group-by ++1 SIMPLE lineitem NULL range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # Using where; Using index flush status; select max(l_orderkey) from lineitem where l_partkey between 1 and 10 group by l_partkey; @@ -192,9 +192,9 @@ @@ -255,7 +255,7 @@ select max(l_orderkey) from lineitem where l_suppkey in (1,4) group by l_suppkey; - id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE lineitem range i_l_suppkey i_l_suppkey 5 NULL # Using where; Using index for group-by -+1 SIMPLE lineitem range i_l_suppkey i_l_suppkey 5 NULL # Using where; Using index + id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE lineitem NULL range i_l_suppkey i_l_suppkey 5 NULL # Using where; Using index for group-by ++1 SIMPLE lineitem NULL range i_l_suppkey i_l_suppkey 5 NULL # Using where; Using index flush status; select max(l_orderkey) from lineitem where l_suppkey in (1,4) group by l_suppkey; @@ -212,11 +212,11 @@ Handler_read_retry 0 Handler_read_rnd 0 @@ -283,7 +283,7 @@ - id select_type table type possible_keys key key_len ref rows Extra - 1 SIMPLE part range i_p_retailprice i_p_retailprice 9 NULL # Using where; Using index - 1 SIMPLE orders ref PRIMARY,i_o_orderdate i_o_orderdate 4 const # Using index --1 SIMPLE lineitem ref i_l_partkey i_l_partkey 9 dbt3_s001.part.p_partkey,dbt3_s001.orders.o_orderkey # Using index -+1 SIMPLE lineitem ref i_l_partkey i_l_partkey 5 dbt3_s001.part.p_partkey # Using where; Using index + id select_type table partitions type possible_keys key key_len ref rows Extra + 1 SIMPLE part NULL range i_p_retailprice i_p_retailprice 9 NULL # Using where; Using index + 1 SIMPLE orders NULL ref PRIMARY,i_o_orderdate i_o_orderdate 4 const # Using index +-1 SIMPLE lineitem NULL ref i_l_partkey i_l_partkey 9 dbt3_s001.part.p_partkey,dbt3_s001.orders.o_orderkey # Using index ++1 SIMPLE lineitem NULL ref i_l_partkey i_l_partkey 5 dbt3_s001.part.p_partkey # Using where; Using index flush status; select o_orderkey, p_partkey from part use index (i_p_retailprice), @@ -232,36 +232,36 @@ @@ -314,8 +314,8 @@ select * from t0, part ignore index (primary) where p_partkey=t0.a and p_size=1; - id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE t0 ALL NULL NULL NULL NULL 5 Using where --1 SIMPLE part eq_ref i_p_size i_p_size 9 const,dbt3_s001.t0.a 1 -+1 SIMPLE t0 ALL NULL NULL NULL NULL 5 -+1 SIMPLE part ref i_p_size i_p_size 5 const 5 Using index condition + id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 5 Using where +-1 SIMPLE part NULL eq_ref i_p_size i_p_size 9 const,dbt3_s001.t0.a 1 ++1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 5 ++1 SIMPLE part NULL ref i_p_size i_p_size 5 const 5 Using index condition select * from t0, part ignore index (primary) where p_partkey=t0.a and p_size=1; a p_partkey p_name p_mfgr p_brand p_type p_size p_container p_retailprice p_comment @@ -494,7 +494,7 @@ select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a; - id select_type table type possible_keys key key_len ref rows Extra - 1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where --1 SIMPLE t3 ref PRIMARY,col1 col1 12 test.t1.a,test.t1.a,test.t1.a # Using index -+1 SIMPLE t3 ref PRIMARY,col1 col1 8 test.t1.a,test.t1.a # Using where; Using index + id select_type table partitions type possible_keys key key_len ref rows Extra + 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # Using where +-1 SIMPLE t3 NULL ref PRIMARY,col1 col1 12 test.t1.a,test.t1.a,test.t1.a # Using index ++1 SIMPLE t3 NULL ref PRIMARY,col1 col1 8 test.t1.a,test.t1.a # Using where; Using index drop table t1,t2,t3; # # Bug mdev-4340: performance regression with extended_keys=on -@@ -714,13 +714,13 @@ +@@ -725,13 +725,13 @@ select * from t1 force index(index_date_updated) where index_date_updated= 10 and index_id < 800; - id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE t1 range index_date_updated index_date_updated 13 NULL # Using index condition -+1 SIMPLE t1 ref index_date_updated index_date_updated 5 const # Using index condition + id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t1 NULL range index_date_updated index_date_updated 13 NULL # Using index condition ++1 SIMPLE t1 NULL ref index_date_updated index_date_updated 5 const # Using index condition # This used to work from the start: explain select * from t2 force index(index_date_updated) where index_date_updated= 10 and index_id < 800; - id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE t2 range index_date_updated index_date_updated 13 NULL # Using index condition -+1 SIMPLE t2 ref index_date_updated index_date_updated 5 const # Using index condition + id select_type table partitions type possible_keys key key_len ref rows Extra +-1 SIMPLE t2 NULL range index_date_updated index_date_updated 13 NULL # Using index condition ++1 SIMPLE t2 NULL ref index_date_updated index_date_updated 5 const # Using index condition drop table t0,t1,t2; # # MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff' diff --git a/mysql-test/main/innodb_ext_key.result b/mysql-test/main/innodb_ext_key.result index 3025e3ec3f0..a42d187e9f0 100644 --- a/mysql-test/main/innodb_ext_key.result +++ b/mysql-test/main/innodb_ext_key.result @@ -8,8 +8,8 @@ CREATE DATABASE dbt3_s001; use dbt3_s001; explain select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 const,const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 const,const 1 Using index flush status; select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01'; count(*) @@ -28,8 +28,8 @@ Handler_read_rnd_next 0 explain select count(*) from lineitem use index(primary) where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem const PRIMARY PRIMARY 8 const,const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL const PRIMARY PRIMARY 8 const,const 1 flush status; select count(*) from lineitem use index(primary) where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01'; @@ -49,8 +49,8 @@ Handler_read_rnd_next 0 explain select count(*) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 1 Using where; Using index flush status; select count(*) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000; @@ -70,8 +70,8 @@ Handler_read_rnd_next 0 explain select l_orderkey, l_linenumber from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 3 Using where; Using index flush status; select l_orderkey, l_linenumber from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000; @@ -92,8 +92,8 @@ Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 explain select min(l_orderkey) from lineitem where l_shipdate='1992-07-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away flush status; select min(l_orderkey) from lineitem where l_shipdate='1992-07-01'; min(l_orderkey) @@ -112,8 +112,8 @@ Handler_read_rnd_next 0 explain select min(l_orderkey) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away flush status; select min(l_orderkey) from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000; @@ -133,8 +133,8 @@ Handler_read_rnd_next 0 explain select max(l_linenumber) from lineitem where l_shipdate='1992-07-01' and l_orderkey=130; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away flush status; select max(l_linenumber) from lineitem where l_shipdate='1992-07-01' and l_orderkey=130; @@ -156,8 +156,8 @@ select l_orderkey, l_linenumber from lineitem use index (i_l_shipdate, i_l_receiptdate) where l_shipdate='1992-07-01' and l_orderkey=130 or l_receiptdate='1992-07-01' and l_orderkey=5603; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 2 Using union(i_l_shipdate,i_l_receiptdate); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 2 Using union(i_l_shipdate,i_l_receiptdate); Using where flush status; select l_orderkey, l_linenumber from lineitem use index (i_l_shipdate, i_l_receiptdate) @@ -182,8 +182,8 @@ select l_orderkey, l_linenumber from lineitem use index (i_l_shipdate, i_l_receiptdate) where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000 or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate # NULL 3 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate # NULL 3 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where flush status; select l_orderkey, l_linenumber from lineitem use index (i_l_shipdate, i_l_receiptdate) @@ -208,8 +208,8 @@ explain select l_orderkey, l_linenumber from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000 or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,i_l_receiptdate # NULL # Using +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,i_l_receiptdate # NULL # Using flush status; select l_orderkey, l_linenumber from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000 @@ -224,8 +224,8 @@ Handler_read_next 3 explain select max(l_orderkey) from lineitem where l_partkey between 1 and 10 group by l_partkey; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # Using where; Using index for group-by flush status; select max(l_orderkey) from lineitem where l_partkey between 1 and 10 group by l_partkey; @@ -254,8 +254,8 @@ Handler_read_rnd_next 0 explain select max(l_orderkey) from lineitem where l_suppkey in (1,4) group by l_suppkey; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range i_l_suppkey i_l_suppkey 5 NULL # Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range i_l_suppkey i_l_suppkey 5 NULL # Using where; Using index for group-by flush status; select max(l_orderkey) from lineitem where l_suppkey in (1,4) group by l_suppkey; @@ -280,10 +280,10 @@ from part use index (i_p_retailprice), lineitem use index (i_l_partkey), orders where p_retailprice > 1100 and o_orderdate='1997-01-01' and o_orderkey=l_orderkey and p_partkey=l_partkey; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE part range i_p_retailprice i_p_retailprice 9 NULL # Using where; Using index -1 SIMPLE orders ref PRIMARY,i_o_orderdate i_o_orderdate 4 const # Using index -1 SIMPLE lineitem ref i_l_partkey i_l_partkey 9 dbt3_s001.part.p_partkey,dbt3_s001.orders.o_orderkey # Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE part NULL range i_p_retailprice i_p_retailprice 9 NULL # Using where; Using index +1 SIMPLE orders NULL ref PRIMARY,i_o_orderdate i_o_orderdate 4 const # Using index +1 SIMPLE lineitem NULL ref i_l_partkey i_l_partkey 9 dbt3_s001.part.p_partkey,dbt3_s001.orders.o_orderkey # Using index flush status; select o_orderkey, p_partkey from part use index (i_p_retailprice), @@ -313,9 +313,9 @@ create index i_p_size on part(p_size); explain select * from t0, part ignore index (primary) where p_partkey=t0.a and p_size=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 5 Using where -1 SIMPLE part eq_ref i_p_size i_p_size 9 const,dbt3_s001.t0.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE part NULL eq_ref i_p_size i_p_size 9 const,dbt3_s001.t0.a 1 select * from t0, part ignore index (primary) where p_partkey=t0.a and p_size=1; a p_partkey p_name p_mfgr p_brand p_type p_size p_container p_retailprice p_comment @@ -338,11 +338,11 @@ a b 2 2 EXPLAIN SELECT * FROM t1 WHERE 2 IN (SELECT MAX(s1.a) FROM t1 AS s1, t1 AS s2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 MATERIALIZED s1 ALL NULL NULL NULL NULL 2 -2 MATERIALIZED s2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL const distinct_key distinct_key 4 const 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 MATERIALIZED s1 NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED s2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) DROP TABLE t1; set optimizer_switch=@save_optimizer_switch; # @@ -383,11 +383,11 @@ INSERT INTO t2 VALUES EXPLAIN SELECT a FROM t1 AS t, t2 WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t index a,b b 7 NULL 10 Using index -1 PRIMARY t1 ref b b 3 test.t.b 2 Using index; Start temporary -1 PRIMARY t2 index NULL PRIMARY 4 NULL 11 Using index; End temporary; Using join buffer (flat, BNL join) -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL index a,b b 7 NULL 10 Using index +1 PRIMARY t1 NULL ref b b 3 test.t.b 2 Using index; Start temporary +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 11 Using index; End temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t.a 1 Using index SELECT a FROM t1 AS t, t2 WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b); a @@ -406,9 +406,9 @@ SET optimizer_switch='join_cache_hashed=on'; SET optimizer_switch='join_cache_bka=on'; EXPLAIN SELECT * FROM t1, t2 WHERE b=a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.a 2 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 5 test.t1.a 2 Using where; Using join buffer (flat, BNLH join) SELECT * FROM t1, t2 WHERE b=a; a b set join_cache_level=@save_join_cache_level; @@ -449,9 +449,9 @@ A.a + 10 * B.a, A.a + 10 * B.a, A.a + 10 * B.a from t1 A, t1 B; explain select * from t1, t2 where t2.a=t1.a and t2.b < 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL # -1 SIMPLE t2 eq_ref a a 4 test.t1.a # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # +1 SIMPLE t2 NULL eq_ref a a 4 test.t1.a # Using where flush status; select * from t1, t2 where t2.a=t1.a and t2.b < 2; a pk a b @@ -487,14 +487,14 @@ test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK explain select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where -1 SIMPLE t3 ref col1 col1 8 test.t1.a,test.t1.a # Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # Using where +1 SIMPLE t3 NULL ref col1 col1 8 test.t1.a,test.t1.a # Using index explain select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where -1 SIMPLE t3 ref PRIMARY,col1 col1 12 test.t1.a,test.t1.a,test.t1.a # Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # Using where +1 SIMPLE t3 NULL ref PRIMARY,col1 col1 12 test.t1.a,test.t1.a,test.t1.a # Using index drop table t1,t2,t3; # # Bug mdev-4340: performance regression with extended_keys=on @@ -617,10 +617,10 @@ EXPLAIN SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3 WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox' ORDER BY rev_timestamp ASC LIMIT 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY,name_title name_title 261 const,const 1 -1 SIMPLE t2 ref page_timestamp page_timestamp 4 const 10 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.rev_text_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY,name_title name_title 261 const,const 1 +1 SIMPLE t2 NULL ref page_timestamp page_timestamp 4 const 10 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.rev_text_id 1 DROP TABLE t1,t2,t3; # # MDEV-5424 SELECT using ORDER BY DESC and LIMIT produces unexpected @@ -637,30 +637,30 @@ test.t1 analyze status OK test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain select a from t1 where b is null order by a desc limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index b PRIMARY 8 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index b PRIMARY 8 NULL 2 Using where select a from t1 where b is null order by a desc limit 2; a 3 2 explain select a from t2 where b is null order by a desc limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range b b 9 NULL 3 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range b b 9 NULL 3 Using where; Using filesort select a from t2 where b is null order by a desc limit 2; a 3 2 explain select a from t2 where b is null order by a desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b PRIMARY 8 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index b PRIMARY 8 NULL 3 Using where select a from t2 where b is null order by a desc; a 3 2 1 explain select a from t2 where b is null order by a desc,a,a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b PRIMARY 8 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index b PRIMARY 8 NULL 3 Using where select a from t2 where b is null order by a desc,a,a; a 3 @@ -724,14 +724,14 @@ insert into t2 select * from t1; explain select * from t1 force index(index_date_updated) where index_date_updated= 10 and index_id < 800; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range index_date_updated index_date_updated 13 NULL # Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range index_date_updated index_date_updated 13 NULL # Using index condition # This used to work from the start: explain select * from t2 force index(index_date_updated) where index_date_updated= 10 and index_id < 800; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range index_date_updated index_date_updated 13 NULL # Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range index_date_updated index_date_updated 13 NULL # Using index condition drop table t0,t1,t2; # # MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff' @@ -831,8 +831,8 @@ PRIMARY KEY(pk) )ENGINE=INNODB; INSERT INTO t2 SELECT a,a FROM t1; EXPLAIN SELECT pk FROM t2 FORCE INDEX(k1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL k1 23 NULL # Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL k1 23 NULL # Using index DROP TABLE t1,t2; set global innodb_stats_persistent= @innodb_stats_persistent_save; set global innodb_stats_persistent_sample_pages= @innodb_stats_persistent_sample_pages_save; diff --git a/mysql-test/main/innodb_ext_key.test b/mysql-test/main/innodb_ext_key.test index f1cf6658f0b..bb57c6412b9 100644 --- a/mysql-test/main/innodb_ext_key.test +++ b/mysql-test/main/innodb_ext_key.test @@ -86,7 +86,7 @@ select l_orderkey, l_linenumber or l_receiptdate='1992-07-01' and l_orderkey=5603; show status like 'handler_read%'; ---replace_column 7 # +--replace_column 8 # explain select l_orderkey, l_linenumber from lineitem use index (i_l_shipdate, i_l_receiptdate) @@ -99,7 +99,7 @@ select l_orderkey, l_linenumber or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000; show status like 'handler_read%'; ---replace_column 7 # 9 # 10 Using +--replace_column 8 # 10 # 11 Using explain select l_orderkey, l_linenumber from lineitem where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000 @@ -110,7 +110,7 @@ select l_orderkey, l_linenumber from lineitem or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000; show status like 'handler_read_next'; ---replace_column 9 # +--replace_column 10 # explain select max(l_orderkey) from lineitem where l_partkey between 1 and 10 group by l_partkey; @@ -119,7 +119,7 @@ select max(l_orderkey) from lineitem where l_partkey between 1 and 10 group by l_partkey; show status like 'handler_read%'; ---replace_column 9 # +--replace_column 10 # explain select max(l_orderkey) from lineitem where l_suppkey in (1,4) group by l_suppkey; @@ -130,7 +130,7 @@ show status like 'handler_read%'; create index i_p_retailprice on part(p_retailprice); ---replace_column 9 # +--replace_column 10 # explain select o_orderkey, p_partkey from part use index (i_p_retailprice), @@ -312,7 +312,7 @@ select A.a + 10 * B.a, A.a + 10 * B.a, A.a + 10 * B.a from t1 A, t1 B; ---replace_column 9 # +--replace_column 10 # explain select * from t1, t2 where t2.a=t1.a and t2.b < 2; flush status; @@ -338,10 +338,10 @@ alter table t3 add primary key (pk1, pk2); alter table t3 add key (col1, col2); analyze table t1,t3; ---replace_column 9 # +--replace_column 10 # explain select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a; ---replace_column 9 # +--replace_column 10 # explain select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a; @@ -565,13 +565,13 @@ insert into t2 select * from t1; --echo # This must have the same query plan as the query below it: --echo # type=range, key=index_date_updated, key_len=13 ---replace_column 9 # +--replace_column 10 # explain select * from t1 force index(index_date_updated) where index_date_updated= 10 and index_id < 800; --echo # This used to work from the start: ---replace_column 9 # +--replace_column 10 # explain select * from t2 force index(index_date_updated) where index_date_updated= 10 and index_id < 800; @@ -641,7 +641,7 @@ CREATE TABLE t2 ( )ENGINE=INNODB; INSERT INTO t2 SELECT a,a FROM t1; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT pk FROM t2 FORCE INDEX(k1); DROP TABLE t1,t2; diff --git a/mysql-test/main/innodb_icp.result b/mysql-test/main/innodb_icp.result index c89d49cad0c..39d9ed3b3b0 100644 --- a/mysql-test/main/innodb_icp.result +++ b/mysql-test/main/innodb_icp.result @@ -171,8 +171,8 @@ FROM t1 WHERE ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00' ORDER BY ts DESC LIMIT 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 4 Using where DROP TABLE t1; # @@ -208,8 +208,8 @@ KEY (c1(6),i1) INSERT INTO t3 SELECT CONCAT('c-',1000+t2.a,'=w'), 1 FROM t2; EXPLAIN SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range c1 c1 8 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL range c1 c1 8 NULL 3 Using where SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w'; c1 c-1004=w @@ -217,14 +217,14 @@ c-1005=w c-1006=w EXPLAIN SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' and i1 > 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range c1 c1 12 NULL 2 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL range c1 c1 12 NULL 2 Using index condition; Using where SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' and i1 > 2; c1 EXPLAIN SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' or i1 > 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL c1 NULL NULL NULL 100 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL c1 NULL NULL NULL 100 Using where SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' or i1 > 2; c1 c-1004=w @@ -413,8 +413,8 @@ FROM t1 WHERE (pk BETWEEN 4 AND 5 OR pk < 2) AND c1 < 240 ORDER BY c1 LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,k1 k1 5 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,k1 k1 5 NULL 4 Using where; Using index DROP TABLE t1; # # @@ -434,10 +434,10 @@ set optimizer_switch='semijoin=off'; EXPLAIN SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL # Using where -2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func # Using where -2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL # Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL # Using where +2 DEPENDENT SUBQUERY it NULL eq_ref PRIMARY PRIMARY 4 func # Using where +2 DEPENDENT SUBQUERY t2 NULL index NULL PRIMARY 4 NULL # Using index; Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10); pk i @@ -456,8 +456,8 @@ PRIMARY KEY (pk) ); INSERT INTO t1 VALUES (1,9),(2,7),(3,6),(4,3),(5,1); EXPLAIN SELECT pk, c1 FROM t1 WHERE (pk<3 or pk>3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 4 Using where SET SESSION optimizer_switch='index_condition_pushdown=off'; SELECT pk, c1 FROM t1 WHERE (pk<3 or pk>3); pk c1 @@ -511,9 +511,9 @@ EXPLAIN SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1 WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR (t1.pk > 1 AND t2.pk BETWEEN 6 AND 6); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using where -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 1 Using where +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Using join buffer (flat, BNL join) SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1 WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR (t1.pk > 1 AND t2.pk BETWEEN 6 AND 6); @@ -604,9 +604,9 @@ test.t2 analyze status OK EXPLAIN SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t2.pk <> t1.d1 AND t2.pk = 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL k1 9 NULL 3 Using index -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL k1 9 NULL 3 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 Using where SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t2.pk <> t1.d1 AND t2.pk = 4; d1 pk i1 @@ -614,9 +614,9 @@ d1 pk i1 EXPLAIN SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t1.d1 <> t2.pk AND t2.pk = 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL k1 9 NULL 3 Using index -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL k1 9 NULL 3 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 Using where SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t1.d1 <> t2.pk AND t2.pk = 4; d1 pk i1 @@ -657,8 +657,8 @@ EXPLAIN SELECT * FROM t1 WHERE NOT(b = 'Texas') AND b BETWEEN 'wy' AND 'y' OR b = 'Pennsylvania' ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range b b 13 NULL # Using where; Rowid-ordered scan; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range b b 13 NULL # Using where; Rowid-ordered scan; Using filesort SELECT * FROM t1 WHERE NOT(b = 'Texas') AND b BETWEEN 'wy' AND 'y' OR b = 'Pennsylvania' ORDER BY a; @@ -669,8 +669,8 @@ EXPLAIN SELECT * FROM t1 WHERE NOT(b = 'Texas') AND b BETWEEN 'wy' AND 'y' OR b = 'Pennsylvania' ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range b b 13 NULL # Using index condition; Rowid-ordered scan; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range b b 13 NULL # Using index condition; Rowid-ordered scan; Using filesort SELECT * FROM t1 WHERE NOT(b = 'Texas') AND b BETWEEN 'wy' AND 'y' OR b = 'Pennsylvania' ORDER BY a; @@ -691,9 +691,9 @@ SET SESSION optimizer_switch='index_condition_pushdown=off'; EXPLAIN SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND (t1.b<0 OR t1.b>0) HAVING t1.c != 5 ORDER BY t1.c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where; Using filesort -1 SIMPLE t2 ref a a 515 test.t1.a # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL # Using where; Using filesort +1 SIMPLE t2 NULL ref a a 515 test.t1.a # Using where SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND (t1.b<0 OR t1.b>0) HAVING t1.c != 5 ORDER BY t1.c; b c @@ -702,9 +702,9 @@ SET SESSION optimizer_switch='index_condition_pushdown=on'; EXPLAIN SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND (t1.b<0 OR t1.b>0) HAVING t1.c != 5 ORDER BY t1.c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where; Using filesort -1 SIMPLE t2 ref a a 515 test.t1.a # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL # Using where; Using filesort +1 SIMPLE t2 NULL ref a a 515 test.t1.a # Using where SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND (t1.b<0 OR t1.b>0) HAVING t1.c != 5 ORDER BY t1.c; b c @@ -821,11 +821,11 @@ SELECT COUNT(*) FROM t1 AS t, t2 WHERE c = g AND (EXISTS (SELECT * FROM t1, t2 WHERE a = f AND h <= t.e AND a > t.b) OR a = 0 AND h < 'z' ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t ALL PRIMARY,c NULL NULL NULL 64 Using where -1 PRIMARY t2 ref g g 5 test.t.c 18 Using where -2 DEPENDENT SUBQUERY t1 index PRIMARY d 3 NULL 64 Using where; Using index -2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL ALL PRIMARY,c NULL NULL NULL 64 Using where +1 PRIMARY t2 NULL ref g g 5 test.t.c 18 Using where +2 DEPENDENT SUBQUERY t1 NULL index PRIMARY d 3 NULL 64 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where SELECT COUNT(*) FROM t1 AS t, t2 WHERE c = g AND (EXISTS (SELECT * FROM t1, t2 WHERE a = f AND h <= t.e AND a > t.b) @@ -899,8 +899,8 @@ aa x a y EXPLAIN SELECT * FROM t1 FORCE INDEX(idx1) WHERE (c1='aa' AND c2='x') OR (c1='a' AND c2='y'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1 idx1 10 NULL 2 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1 idx1 10 NULL 2 Using index condition; Using where SELECT * FROM t1 FORCE INDEX(idx1) WHERE (c1='aa' AND c2='x') OR (c1='a' AND c2='y'); c1 c2 aa x diff --git a/mysql-test/main/innodb_icp_debug.result b/mysql-test/main/innodb_icp_debug.result index 5a169650c8e..8feb823446c 100644 --- a/mysql-test/main/innodb_icp_debug.result +++ b/mysql-test/main/innodb_icp_debug.result @@ -17,8 +17,8 @@ engine InnoDB explain select * from t2 where kp1 between 10 and 20 and kp2 +1 >100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range kp1 kp1 5 NULL 11 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range kp1 kp1 5 NULL 11 Using index condition set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go'; select * from t2 where kp1 between 10 and 20 and kp2 +1 >100; connect con1, localhost, root,,; diff --git a/mysql-test/main/innodb_mrr_cpk.result b/mysql-test/main/innodb_mrr_cpk.result index 8b9260f4596..77ee648871b 100644 --- a/mysql-test/main/innodb_mrr_cpk.result +++ b/mysql-test/main/innodb_mrr_cpk.result @@ -25,9 +25,9 @@ create table t2 (a char(8)); insert into t2 values ('a-1010=A'), ('a-1030=A'), ('a-1020=A'); This should use join buffer: explain select * from t1, t2 where t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 8 test.t2.a 1 Using join buffer (flat, BKA join); Key-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 8 test.t2.a 1 Using join buffer (flat, BKA join); Key-ordered scan This output must be sorted by value of t1.a: select * from t1, t2 where t1.a=t2.a; a b filler a @@ -47,9 +47,9 @@ from t0 A, t0 B, t0 C; create table t2 (a char(8) character set utf8, b int); insert into t2 values ('a-1010=A', 1010), ('a-1030=A', 1030), ('a-1020=A', 1020); explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 28 test.t2.a,test.t2.b 1 Using join buffer (flat, BKA join); Key-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 28 test.t2.a,test.t2.b 1 Using join buffer (flat, BKA join); Key-ordered scan select * from t1, t2 where t1.a=t2.a and t1.b=t2.b; a b filler a b a-1010=A 1010 filler a-1010=A 1010 @@ -57,9 +57,9 @@ a-1020=A 1020 filler a-1020=A 1020 a-1030=A 1030 filler a-1030=A 1030 insert into t2 values ('a-1030=A', 1030), ('a-1020=A', 1020); explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 28 test.t2.a,test.t2.b 1 Using join buffer (flat, BKA join); Key-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 28 test.t2.a,test.t2.b 1 Using join buffer (flat, BKA join); Key-ordered scan select * from t1, t2 where t1.a=t2.a and t1.b=t2.b; a b filler a b a-1010=A 1010 filler a-1010=A 1010 @@ -80,18 +80,18 @@ from t0 A, t0 B, t0 C; create table t2 (a char(8) character set utf8, b int); insert into t2 values ('a-1010=A', 1010), ('a-1030=A', 1030), ('a-1020=A', 1020); explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 30 test.t2.a,test.t2.b 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 30 test.t2.a,test.t2.b 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan select * from t1, t2 where t1.a=t2.a and t1.b=t2.b; a b filler a b a-1010=A 1010 filler a-1010=A 1010 a-1020=A 1020 filler a-1020=A 1020 a-1030=A 1030 filler a-1030=A 1030 explain select * from t1, t2 where t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 ref PRIMARY PRIMARY 26 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 26 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan select * from t1, t2 where t1.a=t2.a; a b filler a b a-1010=A 1010 filler a-1010=A 1010 @@ -109,9 +109,9 @@ insert into t1 values (11, 33, 125, 'filler'); create table t2 (a int, b int); insert into t2 values (11,33), (11,22), (11,11); explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 ref PRIMARY PRIMARY 8 test.t2.a,test.t2.b 1 Using join buffer (flat, BKA join); Key-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 8 test.t2.a,test.t2.b 1 Using join buffer (flat, BKA join); Key-ordered scan select * from t1, t2 where t1.a=t2.a and t1.b=t2.b; a b c filler a b 11 11 11 filler 11 11 @@ -131,16 +131,16 @@ a b c filler a b 11 11 13 filler 11 11 set join_cache_level=6; explain select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 ref PRIMARY PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100; a b c filler a b set optimizer_switch='index_condition_pushdown=off'; explain select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 ref PRIMARY PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100; a b c filler a b set optimizer_switch='index_condition_pushdown=on'; @@ -168,9 +168,9 @@ set join_cache_level=8; set optimizer_switch='mrr=on,mrr_sort_keys=on'; explain select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 10 -1 SIMPLE t1 ref kp1 kp1 32 test.t2.a 1 Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t1 NULL ref kp1 kp1 32 test.t2.a 1 Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a; a pk kp1 col1 kp1-1000 pk-1000 kp1-1000 val-1000 @@ -224,10 +224,10 @@ insert into t2 select '03b2ca8c','' from t0 A, t0 B, t0 C; set @tmp_mdev5037=@@join_cache_level; set join_cache_level=3; explain SELECT 1 FROM (SELECT url, id FROM t2 LIMIT 1 OFFSET 20) derived RIGHT JOIN t1 ON t1.id = derived.id; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL # -1 PRIMARY <derived2> ref key0 key0 25 test.t1.id # -2 DERIVED t2 ALL NULL NULL NULL NULL # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL # +1 PRIMARY <derived2> NULL ref key0 key0 25 test.t1.id # +2 DERIVED t2 NULL ALL NULL NULL NULL NULL # set join_cache_level= @tmp_mdev5037; drop table t0,t1,t2; # diff --git a/mysql-test/main/innodb_mrr_cpk.test b/mysql-test/main/innodb_mrr_cpk.test index cbebafd3053..f9bb4add7b7 100644 --- a/mysql-test/main/innodb_mrr_cpk.test +++ b/mysql-test/main/innodb_mrr_cpk.test @@ -214,7 +214,7 @@ insert into t2 select '03b2ca8c','' from t0 A, t0 B, t0 C; set @tmp_mdev5037=@@join_cache_level; set join_cache_level=3; ---replace_column 9 # +--replace_column 10 # explain SELECT 1 FROM (SELECT url, id FROM t2 LIMIT 1 OFFSET 20) derived RIGHT JOIN t1 ON t1.id = derived.id; set join_cache_level= @tmp_mdev5037; diff --git a/mysql-test/main/insert_returning.result b/mysql-test/main/insert_returning.result index a3cde7b1270..df03366f3f4 100644 --- a/mysql-test/main/insert_returning.result +++ b/mysql-test/main/insert_returning.result @@ -58,11 +58,11 @@ id1 val1 6 f 7 h EXPLAIN INSERT INTO t1(id1,val1) VALUES (8,'i') RETURNING *; -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL EXPLAIN EXTENDED INSERT INTO t1(id1,val1) VALUES(9,'j') RETURNING id1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 100.00 NULL EXPLAIN FORMAT="json" INSERT INTO t1(id1,val1) VALUES (10,'k') RETURNING id1; EXPLAIN { @@ -87,8 +87,8 @@ id1 && id1, id1 id1, UPPER(val1),f(id1); total val1 id1 && id1 id1 UPPER(val1) f(id1) 24 a 1 12 A 24 ANALYZE INSERT INTO t1(id1,val1) VALUES(13,'l') RETURNING *; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO t1(id1,val1) VALUES(14,'m') RETURNING t1.*; id1 val1 14 m @@ -146,11 +146,11 @@ id1 val1 13 o 14 p EXPLAIN INSERT INTO t1 VALUES(15,'q'),(16,'r') RETURNING *; -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL EXPLAIN EXTENDED INSERT INTO t1 VALUES (17,'s'),(18,'t') RETURNING *; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 100.00 NULL EXPLAIN FORMAT="json" INSERT INTO t1 VALUES(19,'u'),(20,'v') RETURNING id1; EXPLAIN { @@ -183,11 +183,11 @@ id val1 id1 && id1 id1|id1 UPPER(val1) f(id1) 23 y 1 23 Y 46 24 z 1 24 Z 48 ANALYZE INSERT INTO t1 VALUES(25,'a'),(26,'b') RETURNING *; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL ANALYZE INSERT INTO t1 VALUES(27,'c'),(28,'d') RETURNING t1.*; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL # # INSERT...ON DUPLICATE KEY UPDATE...RETURNING # @@ -230,12 +230,12 @@ id 4 EXPLAIN INSERT INTO ins_duplicate(id,val) VALUES (2,'b') ON DUPLICATE KEY UPDATE val='h' RETURNING val; -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT ins_duplicate ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT ins_duplicate NULL ALL NULL NULL NULL NULL NULL NULL EXPLAIN EXTENDED INSERT INTO ins_duplicate(id,val) VALUES (2,'b') ON DUPLICATE KEY UPDATE val='i' RETURNING val; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 INSERT ins_duplicate ALL NULL NULL NULL NULL NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 INSERT ins_duplicate NULL ALL NULL NULL NULL NULL NULL 100.00 NULL EXPLAIN FORMAT="json" INSERT INTO ins_duplicate(id,val) VALUES (2,'b') ON DUPLICATE KEY UPDATE val='j' RETURNING val; EXPLAIN @@ -254,8 +254,8 @@ total val1 id1 && id1 id1|id1 UPPER(val1) f(id1) 4 d 1 2 D 4 ANALYZE INSERT INTO ins_duplicate(id,val) VALUES(2,'b') ON DUPLICATE KEY UPDATE val='k' RETURNING *; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT ins_duplicate ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT ins_duplicate NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO ins_duplicate(id,val) VALUES(2,'b') ON DUPLICATE KEY UPDATE val='l' RETURNING ins_duplicate.*; id val @@ -315,11 +315,11 @@ id1 val1 Warnings: Warning 1062 Duplicate entry '8' for key 'PRIMARY' EXPLAIN INSERT INTO t1 SET id1=9, val1='i' RETURNING id1; -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL EXPLAIN EXTENDED INSERT INTO t1 SET id1=10, val1='j' RETURNING val1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 100.00 NULL EXPLAIN FORMAT="json" INSERT INTO t1 SET id1=11, val1='k' RETURNING val1; EXPLAIN { @@ -335,8 +335,8 @@ id1 && id1, id1|id1, UPPER(val1),f(id1); total val1 id1 && id1 id1|id1 UPPER(val1) f(id1) 52 Z 1 26 Z 52 ANALYZE INSERT INTO t1 SET id1=12, val1='l' RETURNING *; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL INSERT INTO t1 SET id1= 13, val1= 'm' RETURNING t1.*; id1 val1 13 m @@ -399,11 +399,11 @@ INSERT INTO t2 SELECT * FROM t1 WHERE id1=7 RETURNING f(id2); f(id2) 14 EXPLAIN INSERT INTO t2 SELECT * FROM t1 WHERE id1=8 RETURNING id2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL const PRIMARY PRIMARY 4 const 1 EXPLAIN EXTENDED INSERT INTO t1 SELECT * FROM t1 WHERE id1=9 RETURNING val1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN FORMAT="json" INSERT INTO t1 SELECT * FROM t1 WHERE id1=10 RETURNING val1; EXPLAIN { @@ -432,8 +432,8 @@ Warning 1062 Duplicate entry '6' for key 'PRIMARY' Warning 1062 Duplicate entry '7' for key 'PRIMARY' Warning 1062 Duplicate entry '8' for key 'PRIMARY' ANALYZE INSERT INTO t2 SELECT * FROM t1 WHERE id1=11 RETURNING *; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t2; id2 val2 1 a diff --git a/mysql-test/main/insert_select.result b/mysql-test/main/insert_select.result index e85c4982137..d5fb41202d8 100644 --- a/mysql-test/main/insert_select.result +++ b/mysql-test/main/insert_select.result @@ -785,9 +785,9 @@ CREATE TABLE t2 (d VARCHAR(10)); INSERT INTO t1 (c) VALUES ('7_chars'), ('13_characters'); EXPLAIN SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY t1 ref ix_c ix_c 13 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY t1 NULL ref ix_c ix_c 13 const 1 Using where SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') FROM t1; (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') 13 diff --git a/mysql-test/main/insert_update.result b/mysql-test/main/insert_update.result index 68a1003ad85..7261c6ea400 100644 --- a/mysql-test/main/insert_update.result +++ b/mysql-test/main/insert_update.result @@ -57,13 +57,13 @@ a b c VALUE(a) 8 9 60 NULL 2 1 11 NULL explain extended SELECT *, VALUE(a) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,value(`test`.`t1`.`a`) AS `VALUE(a)` from `test`.`t1` explain extended select * from t1 where value(a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where value(`test`.`t1`.`a`) DROP TABLE t1; diff --git a/mysql-test/main/intersect.result b/mysql-test/main/intersect.result index aa6d48553f1..5d85a1f5ffc 100644 --- a/mysql-test/main/intersect.result +++ b/mysql-test/main/intersect.result @@ -18,26 +18,26 @@ insert into t3 values (1,1),(2,2),(5,5); a b 2 2 EXPLAIN (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -2 INTERSECT t2 ALL NULL NULL NULL NULL 3 -3 INTERSECT t3 ALL NULL NULL NULL NULL 3 -NULL INTERSECT RESULT <intersect1,2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 3 +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 3 +NULL INTERSECT RESULT <intersect1,2,3> NULL ALL NULL NULL NULL NULL NULL EXPLAIN extended (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -2 INTERSECT t2 ALL NULL NULL NULL NULL 3 100.00 -3 INTERSECT t3 ALL NULL NULL NULL NULL 3 100.00 -NULL INTERSECT RESULT <intersect1,2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 3 100.00 +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 3 100.00 +NULL INTERSECT RESULT <intersect1,2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) intersect (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (/* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`) EXPLAIN extended select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 -3 INTERSECT t2 ALL NULL NULL NULL NULL 3 100.00 -4 INTERSECT t3 ALL NULL NULL NULL NULL 3 100.00 -NULL INTERSECT RESULT <intersect2,3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 +3 INTERSECT t2 NULL ALL NULL NULL NULL NULL 3 100.00 +4 INTERSECT t3 NULL ALL NULL NULL NULL NULL 3 100.00 +NULL INTERSECT RESULT <intersect2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) intersect (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (/* select#4 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `a` EXPLAIN format=json (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3); @@ -306,26 +306,26 @@ a b a b 2 2 EXPLAIN (select a,b from t1) intersect (select c,e from t2,t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -2 INTERSECT t2 ALL NULL NULL NULL NULL 3 -2 INTERSECT t3 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -NULL INTERSECT RESULT <intersect1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 3 +2 INTERSECT t3 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +NULL INTERSECT RESULT <intersect1,2> NULL ALL NULL NULL NULL NULL NULL EXPLAIN extended (select a,b from t1) intersect (select c,e from t2,t3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -2 INTERSECT t2 ALL NULL NULL NULL NULL 3 100.00 -2 INTERSECT t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -NULL INTERSECT RESULT <intersect1,2> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 3 100.00 +2 INTERSECT t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +NULL INTERSECT RESULT <intersect1,2> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) intersect (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t3`.`e` AS `e` from `test`.`t2` join `test`.`t3`) EXPLAIN extended select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 -3 INTERSECT t2 ALL NULL NULL NULL NULL 3 100.00 -3 INTERSECT t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 +3 INTERSECT t2 NULL ALL NULL NULL NULL NULL 3 100.00 +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) intersect (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t3`.`e` AS `e` from `test`.`t2` join `test`.`t3`)) `a` set @@optimizer_switch='optimize_join_buffer_size=off'; @@ -687,14 +687,14 @@ a b 6 6 explain extended (select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -5 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 -3 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00 -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,5,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +5 UNION <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL NULL +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,5,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union /* select#5 */ select `__5`.`c` AS `c`,`__5`.`d` AS `d` from ((/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (/* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__5` union (/* select#4 */ select 4 AS `4`,4 AS `4`) (select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4); @@ -705,12 +705,12 @@ e f 6 6 explain extended (select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 -2 INTERSECT t2 ALL NULL NULL NULL NULL 2 100.00 -3 UNION t1 ALL NULL NULL NULL NULL 2 100.00 -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT <unit1,2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`) intersect (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) union (/* select#3 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union (/* select#4 */ select 4 AS `4`,4 AS `4`) (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union /* select#3 */ select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (/* select#4 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (/* select#5 */ select 4 AS `4`,4 AS `4`); @@ -907,12 +907,12 @@ union all select * from t2 where a < 5 intersect select * from t3 where a < 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 Using where -4 UNION <derived2> ALL NULL NULL NULL NULL 6 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 6 100.00 Using where -3 INTERSECT t3 ALL NULL NULL NULL NULL 7 100.00 Using where -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +4 UNION <derived2> NULL ALL NULL NULL NULL NULL 6 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 union all /* select#4 */ select `__4`.`a` AS `a` from (/* select#2 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where `test`.`t2`.`a` < 5 intersect /* select#3 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where `test`.`t3`.`a` < 5) `__4` drop table t1,t2,t3; diff --git a/mysql-test/main/intersect_all.result b/mysql-test/main/intersect_all.result index 243497ffc4f..2b80fc73975 100644 --- a/mysql-test/main/intersect_all.result +++ b/mysql-test/main/intersect_all.result @@ -30,26 +30,26 @@ a b 2 2 2 2 EXPLAIN (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 INTERSECT t2 ALL NULL NULL NULL NULL 4 -3 INTERSECT t3 ALL NULL NULL NULL NULL 4 -NULL INTERSECT RESULT <intersect1,2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 4 +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 4 +NULL INTERSECT RESULT <intersect1,2,3> NULL ALL NULL NULL NULL NULL NULL EXPLAIN extended (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00 -2 INTERSECT t2 ALL NULL NULL NULL NULL 4 100.00 -3 INTERSECT t3 ALL NULL NULL NULL NULL 4 100.00 -NULL INTERSECT RESULT <intersect1,2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 4 100.00 +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 4 100.00 +NULL INTERSECT RESULT <intersect1,2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) intersect all (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect all (/* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`) EXPLAIN extended select * from ((select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3)) a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 4 100.00 -3 INTERSECT t2 ALL NULL NULL NULL NULL 4 100.00 -4 INTERSECT t3 ALL NULL NULL NULL NULL 4 100.00 -NULL INTERSECT RESULT <intersect2,3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 4 100.00 +3 INTERSECT t2 NULL ALL NULL NULL NULL NULL 4 100.00 +4 INTERSECT t3 NULL ALL NULL NULL NULL NULL 4 100.00 +NULL INTERSECT RESULT <intersect2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) intersect all (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect all (/* select#4 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `a` EXPLAIN format=json (select a,b from t1) intersect all (select c,d from t2) intersect all (select e,f from t3); @@ -338,26 +338,26 @@ a b 2 2 2 2 EXPLAIN (select a,b from t1) intersect all (select c,e from t2,t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 -2 INTERSECT t3 ALL NULL NULL NULL NULL 5 -2 INTERSECT t2 ALL NULL NULL NULL NULL 7 Using join buffer (flat, BNL join) -NULL INTERSECT RESULT <intersect1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 +2 INTERSECT t3 NULL ALL NULL NULL NULL NULL 5 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 7 Using join buffer (flat, BNL join) +NULL INTERSECT RESULT <intersect1,2> NULL ALL NULL NULL NULL NULL NULL EXPLAIN extended (select a,b from t1) intersect all (select c,e from t2,t3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -2 INTERSECT t3 ALL NULL NULL NULL NULL 5 100.00 -2 INTERSECT t2 ALL NULL NULL NULL NULL 7 100.00 Using join buffer (flat, BNL join) -NULL INTERSECT RESULT <intersect1,2> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +2 INTERSECT t3 NULL ALL NULL NULL NULL NULL 5 100.00 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 7 100.00 Using join buffer (flat, BNL join) +NULL INTERSECT RESULT <intersect1,2> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) intersect all (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t3`.`e` AS `e` from `test`.`t2` join `test`.`t3`) EXPLAIN extended select * from ((select a,b from t1) intersect all (select c,e from t2,t3)) a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 6 100.00 -3 INTERSECT t3 ALL NULL NULL NULL NULL 5 100.00 -3 INTERSECT t2 ALL NULL NULL NULL NULL 7 100.00 Using join buffer (flat, BNL join) -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 6 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 6 100.00 +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 5 100.00 +3 INTERSECT t2 NULL ALL NULL NULL NULL NULL 7 100.00 Using join buffer (flat, BNL join) +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `a`.`a` AS `a`,`a`.`b` AS `b` from ((/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) intersect all (/* select#3 */ select `test`.`t2`.`c` AS `c`,`test`.`t3`.`e` AS `e` from `test`.`t2` join `test`.`t3`)) `a` EXPLAIN format=json (select a,b from t1) intersect all (select c,e from t2,t3); @@ -732,13 +732,13 @@ a b 3 3 4 4 explain extended (select a,b from t1) union all (select c,d from t2) intersect all (select e,f from t3) union all (select 4,4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -5 UNION <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 -3 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00 -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +5 UNION <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL NULL +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union all /* select#5 */ select `__5`.`c` AS `c`,`__5`.`d` AS `d` from ((/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect all (/* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__5` union all (/* select#4 */ select 4 AS `4`,4 AS `4`) insert into t2 values (3,3); @@ -751,12 +751,12 @@ e f 6 6 4 4 explain extended (select e,f from t3) intersect all (select c,d from t2) union all (select a,b from t1) union all (select 4,4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 -2 INTERSECT t2 ALL NULL NULL NULL NULL 3 100.00 -3 UNION t1 ALL NULL NULL NULL NULL 2 100.00 -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 3 100.00 +3 UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT <unit1,2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`) intersect all (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) union all (/* select#3 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union all (/* select#4 */ select 4 AS `4`,4 AS `4`) (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union /* select#3 */ select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect all (/* select#4 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (/* select#5 */ select 4 AS `4`,4 AS `4`); @@ -965,12 +965,12 @@ union all select * from t2 where a < 5 intersect all select * from t3 where a < 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 Using where -4 UNION <derived2> ALL NULL NULL NULL NULL 7 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 8 100.00 Using where -3 INTERSECT t3 ALL NULL NULL NULL NULL 7 100.00 Using where -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +4 UNION <derived2> NULL ALL NULL NULL NULL NULL 7 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 union all /* select#4 */ select `__4`.`a` AS `a` from (/* select#2 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where `test`.`t2`.`a` < 5 intersect all /* select#3 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where `test`.`t3`.`a` < 5) `__4` drop table t1,t2,t3; diff --git a/mysql-test/main/invisible_field.result b/mysql-test/main/invisible_field.result index 081c1ada1ee..d97c1f27ab7 100644 --- a/mysql-test/main/invisible_field.result +++ b/mysql-test/main/invisible_field.result @@ -385,14 +385,14 @@ insert into t1(a,b,c) values(22,22,24); insert into t1(a,b,c) values(32,32,33); insert into t1(a,b,c) values(42,42,43); explain select * from t1 where b=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const b b 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const b b 5 const 1 select * from t1 where b=3; a 3 explain select * from t1 where c=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const c c 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const c c 5 const 1 select * from t1 where c=3; a 3 @@ -403,9 +403,9 @@ a int(11) YES NULL b int(11) YES NULL c int(11) YES NULL explain select * from t1,t2 where t1.b = t2.c and t1.c = t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 eq_ref b,c b 5 test.t2.c 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 NULL eq_ref b,c b 5 test.t2.c 1 Using where select * from t1,t2 where t1.b = t2.c and t1.c = t2.b; a a b c 1 1 1 1 diff --git a/mysql-test/main/invisible_field_debug.result b/mysql-test/main/invisible_field_debug.result index 4cbdb31e155..27c55a195bc 100644 --- a/mysql-test/main/invisible_field_debug.result +++ b/mysql-test/main/invisible_field_debug.result @@ -345,8 +345,8 @@ invisible a b 9 6 6 9 7 7 explain select * from t1 where invisible =9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL invisible NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL invisible NULL NULL NULL 7 Using where alter table t1 add x int default 3; select invisible, a ,b from t1; invisible a b @@ -367,12 +367,12 @@ set debug_dbug= "+d,test_completely_invisible,test_invisible_index"; drop index invisible on t1; ERROR 42000: Can't DROP INDEX `invisible`; check that it exists explain select * from t1 where invisible =9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL invisible NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL invisible NULL NULL NULL 7 Using where create index invisible on t1(c); explain select * from t1 where invisible =9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL invisible_2 NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL invisible_2 NULL NULL NULL 7 Using where show indexes in t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored t1 1 b 1 b A NULL NULL NULL YES BTREE NO diff --git a/mysql-test/main/join.result b/mysql-test/main/join.result index 11b7ecad3ee..313ceff6e7e 100644 --- a/mysql-test/main/join.result +++ b/mysql-test/main/join.result @@ -64,12 +64,12 @@ select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 id id NULL 75 explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 and t1.id is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY NULL NULL NULL 1 Impossible ON condition -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY NULL NULL NULL 1 Impossible ON condition +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where explain select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id <0 and t1.id > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables drop table t1,t2; CREATE TABLE t1 ( id int(11) NOT NULL auto_increment, @@ -407,9 +407,9 @@ INSERT INTO t2 (a, d) SELECT a+8, a+8 FROM t2; EXPLAIN SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e ORDER BY t1.b, t1.c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 32 Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 16 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 32 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 16 Using where; Using join buffer (flat, BNL join) SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e ORDER BY t1.b, t1.c; e @@ -854,10 +854,10 @@ flush status; select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; a b a a explain select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using index -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using index +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index We expect rnd_next=5, and read_key must be 0 because of short-cutting: show status like 'Handler_read%'; Variable_name Value @@ -879,17 +879,17 @@ insert into t2 select @a:= A.a + 10*(B.a + 10*C.a), @a, 'filler' from t1 A, t1 B, t1 C; insert into t3 select * from t2 where a < 800; explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL a,b NULL NULL NULL 1000 Using where -1 SIMPLE t3 ref b b 5 test.t2.b 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL a,b NULL NULL NULL 1000 Using where +1 SIMPLE t3 NULL ref b b 5 test.t2.b 1 drop table t1, t2, t3; create table t1 (a int); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t2 (a int, b int, primary key(a)); insert into t2 select @v:=A.a+10*B.a, @v from t1 A, t1 B; explain select * from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 show status like '%cost%'; Variable_name Value Last_query_cost 4.016090 @@ -900,10 +900,10 @@ select 'vv: Following query must use ALL(t1), eq_ref(A), eq_ref(B): vv' Z; Z vv: Following query must use ALL(t1), eq_ref(A), eq_ref(B): vv explain select * from t1, t2 A, t2 B where A.a = t1.a and B.a=A.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE A eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where -1 SIMPLE B eq_ref PRIMARY PRIMARY 4 test.A.b 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE A NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where +1 SIMPLE B NULL eq_ref PRIMARY PRIMARY 4 test.A.b 1 show status like '%cost%'; Variable_name Value Last_query_cost 28.016090 @@ -921,13 +921,13 @@ INSERT INTO t1 SELECT a + 32, b FROM t1; INSERT INTO t1 SELECT a + 64, b FROM t1; INSERT INTO t2 SELECT a, b FROM t1; EXPLAIN SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a LIMIT 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 EXPLAIN SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a LIMIT 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 4 NULL 2 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a LIMIT 2; a b c d SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a LIMIT 2; @@ -935,13 +935,13 @@ a b c d 1 NULL 1 NULL 2 NULL 2 NULL EXPLAIN SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using where; Using filesort -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 128 Using where; Using filesort +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 EXPLAIN SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 128 Using filesort -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 128 Using filesort +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a; a b c d SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a; @@ -1105,13 +1105,13 @@ t5 LEFT JOIN t6 ON t5.a = t6.a ON t4.a = t5.a ) ON t1.a = t3.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t3 ref a a 5 test.t1.a 2 Using where; Using index -1 SIMPLE t4 ALL NULL NULL NULL NULL 0 Using where -1 SIMPLE t5 ALL NULL NULL NULL NULL 0 Using where -1 SIMPLE t6 ALL NULL NULL NULL NULL 0 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t3 NULL ref a a 5 test.t1.a 2 Using where; Using index +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) SELECT * FROM t1 JOIN t2 ON t1.a = t2.a @@ -1137,11 +1137,11 @@ INSERT INTO t1 VALUES (1),(2); CREATE VIEW v1 AS SELECT 1 FROM t1 LEFT JOIN t1 AS t2 on 1=1; EXPLAIN EXTENDED SELECT 1 FROM v1 right join v1 AS v2 ON RAND(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select 1 AS `1` from `test`.`t1` left join `test`.`t1` `t2` on(1 = 1) left join (`test`.`t1` left join `test`.`t1` `t2` on(1 = 1)) on(rand()) where 1 DROP VIEW v1; @@ -1155,8 +1155,8 @@ FLUSH TABLES; EXPLAIN SELECT 1 FROM t1 LEFT JOIN t1 a ON 1 WHERE ROW(t1.a, 1111.11) = ROW(1111.11, 1111.11) AND ROW(t1.b, 1111.11) <=> ROW('',''); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t1; # # Bug #50335: Assertion `!(order->used & map)' in eq_ref_table @@ -1260,11 +1260,11 @@ CREATE INDEX ix2 ON t2(v); INSERT INTO t1 VALUES (1,'a'),(2,NULL); INSERT INTO t2 VALUES (1,NULL); EXPLAIN SELECT * FROM t1 JOIN t2 ON t1.v = t2.v ORDER BY 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 JOIN t2 ON t1.v = t2.v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables INSERT INTO t1 VALUES (3,'b'),(4,NULL),(5,'c'),(6,'cc'),(7,'d'), (8,'dd'),(9,'e'),(10,'ee'); INSERT INTO t2 VALUES (2,NULL); @@ -1312,31 +1312,31 @@ SELECT * FROM t4 JOIN (t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1) ON t4.ref_t1=t1.c1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) EXPLAIN SELECT STRAIGHT_JOIN * FROM t4 JOIN (t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1) ON t4.ref_t1=t1.c1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) EXPLAIN SELECT * FROM t4 STRAIGHT_JOIN (t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1) ON t4.ref_t1=t1.c1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t4.ref_t1 1 -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t4.ref_t1 1 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) drop table t1,t2,t3,t4; End of 5.2 tests # @@ -1384,9 +1384,9 @@ INSERT INTO t2 VALUES (5,7), (8,9); EXPLAIN SELECT * FROM t1 STRAIGHT_JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1<>0 OR t1.f2<>0 AND t1.f1 = t2.f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t2 ALL f2 NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 NULL ALL f2 NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) SELECT * FROM t1 STRAIGHT_JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1<>0 OR t1.f2<>0 AND t1.f1 = t2.f2; f1 f2 f1 f2 @@ -1399,10 +1399,10 @@ INSERT INTO t2 VALUES (9,4), (10,9); EXPLAIN SELECT STRAIGHT_JOIN * FROM t1 JOIN t2 ON t2.f2 = t1.f1 WHERE t1.f1 IN (SELECT f1 FROM t1) AND t1.f1 = t2.f1 OR t1.f1 = 9; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 2 Using where -1 PRIMARY t2 ALL PRIMARY NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 2 Using where +1 PRIMARY t2 NULL ALL PRIMARY NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t1 NULL unique_subquery PRIMARY PRIMARY 4 func 1 Using index SELECT STRAIGHT_JOIN * FROM t1 JOIN t2 ON t2.f2 = t1.f1 WHERE t1.f1 IN (SELECT f1 FROM t1) AND t1.f1 = t2.f1 OR t1.f1 = 9; f1 f2 f1 f2 @@ -1469,12 +1469,12 @@ EXPLAIN SELECT * FROM t5 DU, t1 D, t4 DT, t2 DSA, t3 DSAR WHERE DU.dog_id=D.dog_id AND D.dog_id=DT.dog_id AND D.birthday=DT.birthday AND DT.t_id=DSA.t_id AND DT.birthday=DSA.birthday AND DSA.dog_id=DSAR.dog_id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE DU system dog_id NULL NULL NULL 1 -1 SIMPLE D system PRIMARY NULL NULL NULL 1 -1 SIMPLE DSAR system NULL NULL NULL NULL 1 -1 SIMPLE DSA ref PRIMARY PRIMARY 4 const 3 Using where; Using index -1 SIMPLE DT ALL t_id NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE DU NULL system dog_id NULL NULL NULL 1 +1 SIMPLE D NULL system PRIMARY NULL NULL NULL 1 +1 SIMPLE DSAR NULL system NULL NULL NULL NULL 1 +1 SIMPLE DSA NULL ref PRIMARY PRIMARY 4 const 3 Using where; Using index +1 SIMPLE DT NULL ALL t_id NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) SELECT * FROM t5 DU, t1 D, t4 DT, t2 DSA, t3 DSAR WHERE DU.dog_id=D.dog_id AND D.dog_id=DT.dog_id AND D.birthday=DT.birthday AND DT.t_id=DSA.t_id AND DT.birthday=DSA.birthday AND DSA.dog_id=DSAR.dog_id; @@ -1503,9 +1503,9 @@ SELECT * FROM t1 JOIN v2 ON i1 = i2 WHERE a < b; i1 i2 a b EXPLAIN EXTENDED SELECT * FROM t1 JOIN v2 ON i1 = i2 WHERE a < b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 /* select#1 */ select NULL AS `i1`,`v2`.`i2` AS `i2`,`v2`.`a` AS `a`,`v2`.`b` AS `b` from `test`.`v2` where `v2`.`i2` = NULL and `v2`.`a` < `v2`.`b` DROP VIEW v2; @@ -1567,10 +1567,10 @@ create table t4 (a int); insert into t4 values (4), (7), (9), (5); explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join t2 join t3 on t2.a=t3.a on t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t3`.`a` = `test`.`t1`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1579,10 +1579,10 @@ t1_a t2_a t3_a 7 7 7 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join t2 left join t3 on t2.a=t3.a on t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t1`.`a`) where `test`.`t2`.`a` = `test`.`t1`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1592,10 +1592,10 @@ t1_a t2_a t3_a 5 5 NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join t2 right join t3 on t2.a=t3.a on t1.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t3` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t1`.`a`) where `test`.`t3`.`a` = `test`.`t1`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1605,10 +1605,10 @@ t1_a t2_a t3_a 3 NULL 3 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join t2 join t3 using(a) using(a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t3`.`a` = `test`.`t1`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1617,10 +1617,10 @@ t1_a t2_a t3_a 7 7 7 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join t2 left join t3 using(a) using(a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t1`.`a`) where `test`.`t2`.`a` = `test`.`t1`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1630,10 +1630,10 @@ t1_a t2_a t3_a 5 5 NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join t2 right join t3 using(a) using(a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t3` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t1`.`a`) where `test`.`t3`.`a` = `test`.`t1`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1643,10 +1643,10 @@ t1_a t2_a t3_a 3 NULL 3 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join t2 join t3 on t2.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1657,10 +1657,10 @@ t1_a t2_a t3_a 3 7 7 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join t2 left join t3 on t2.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t2`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1677,10 +1677,10 @@ t1_a t2_a t3_a 3 1 NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join t2 right join t3 on t2.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t3` left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1693,10 +1693,10 @@ NULL NULL 2 NULL NULL 3 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join t2 join t3 on t1.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t1`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1710,10 +1710,10 @@ t1_a t2_a t3_a 3 7 3 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join t2 left join t3 on t1.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t1`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1730,10 +1730,10 @@ t1_a t2_a t3_a 5 7 NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join t2 right join t3 on t1.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t3` left join (`test`.`t1` join `test`.`t2`) on(`test`.`t1`.`a` = `test`.`t3`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1748,10 +1748,10 @@ t1_a t2_a t3_a NULL NULL 2 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join (t2 join t3 on t2.a=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1762,10 +1762,10 @@ t1_a t2_a t3_a 3 7 7 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join (t2 left join t3 on t2.a=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t2`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1782,10 +1782,10 @@ t1_a t2_a t3_a 3 1 NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join (t2 right join t3 on t2.a=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t3` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -1802,10 +1802,10 @@ t1_a t2_a t3_a 3 NULL 3 explain extended select * from s1 join t2 join t3 using(a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`s1`.`b` AS `b` from `test`.`s1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` select * @@ -1816,10 +1816,10 @@ a b 7 3 explain extended select * from s1 join t2 left join t3 using(a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`s1`.`b` AS `b` from `test`.`s1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t2`.`a`) where 1 select * @@ -1836,10 +1836,10 @@ a b 1 3 explain extended select * from s1 join t2 right join t3 using(a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`s1`.`b` AS `b` from `test`.`t3` left join (`test`.`s1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1 select * @@ -1852,10 +1852,10 @@ a b 3 NULL explain extended select s1.b, t2.a as t2_a, t3.a as t3_a from s1 join t2 join t3 using(a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `b`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`s1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` select s1.b, t2.a as t2_a, t3.a as t3_a @@ -1866,10 +1866,10 @@ b t2_a t3_a 3 7 7 explain extended select s1.b, t2.a as t2_a, t3.a as t3_a from s1 join t2 left join t3 using(a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `b`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`s1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t2`.`a`) where 1 select s1.b, t2.a as t2_a, t3.a as t3_a @@ -1886,10 +1886,10 @@ b t2_a t3_a 3 1 NULL explain extended select s1.b, t2.a as t2_a, t3.a as t3_a from s1 join t2 right join t3 using(a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `b`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t3` left join (`test`.`s1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1 select s1.b, t2.a as t2_a, t3.a as t3_a @@ -1902,10 +1902,10 @@ NULL NULL 2 NULL NULL 3 explain extended select s1.b, t2.a as t2_a, t3.a as t3_a from (s1 join t2) right join t3 using(a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `b`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t3` left join (`test`.`s1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1 select s1.b, t2.a as t2_a, t3.a as t3_a @@ -1918,10 +1918,10 @@ NULL NULL 2 NULL NULL 3 explain extended select * from s1 join t2 natural join t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`s1`.`b` AS `b` from `test`.`s1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` select * @@ -1932,10 +1932,10 @@ a b 7 3 explain extended select * from s1 join t2 natural left join t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`s1`.`b` AS `b` from `test`.`s1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t2`.`a`) where 1 select * @@ -1952,10 +1952,10 @@ a b 1 3 explain extended select * from s1 join t2 natural right join t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`s1`.`b` AS `b` from `test`.`t3` left join (`test`.`s1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1 select * @@ -1968,10 +1968,10 @@ a b 3 NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join t2 join t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -2007,10 +2007,10 @@ t1_a t2_a t3_a explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from t1 join t2 join t3 where t1.a=t2.a and t2.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t3`.`a` = `test`.`t1`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -2020,11 +2020,11 @@ t1_a t2_a t3_a 7 7 7 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 join t3 join t4 on t3.a=t4.a on t2.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` where `test`.`t3`.`a` = `test`.`t2`.`a` and `test`.`t4`.`a` = `test`.`t2`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2035,11 +2035,11 @@ t1_a t2_a t3_a t4_a 3 7 7 7 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 left join t3 join t4 on t3.a=t4.a on t2.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = `test`.`t2`.`a` and `test`.`t4`.`a` = `test`.`t2`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2056,11 +2056,11 @@ t1_a t2_a t3_a t4_a 3 1 NULL NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 left join t3 left join t4 on t3.a=t4.a on t2.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t2`.`a`)) on(`test`.`t3`.`a` = `test`.`t2`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2077,11 +2077,11 @@ t1_a t2_a t3_a t4_a 3 1 NULL NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 left join t3 right join t4 on t3.a=t4.a on t2.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` left join (`test`.`t4` join `test`.`t3`) on(`test`.`t3`.`a` = `test`.`t2`.`a` and `test`.`t4`.`a` = `test`.`t2`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2098,11 +2098,11 @@ t1_a t2_a t3_a t4_a 3 1 NULL NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 right join t3 join t4 on t3.a=t4.a on t2.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where `test`.`t4`.`a` = `test`.`t3`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2113,11 +2113,11 @@ t1_a t2_a t3_a t4_a 3 7 7 7 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 right join t3 left join t4 on t3.a=t4.a on t2.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t3`.`a`) left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2130,11 +2130,11 @@ NULL NULL 2 NULL NULL NULL 3 NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t4`.`a`) left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2148,11 +2148,11 @@ NULL NULL NULL 9 NULL NULL NULL 5 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 join t3 join t4 on t3.a=t4.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` where `test`.`t4`.`a` = `test`.`t3`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2169,11 +2169,11 @@ t1_a t2_a t3_a t4_a 3 7 7 7 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 join t3 left join t4 on t3.a=t4.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t3`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2208,11 +2208,11 @@ t1_a t2_a t3_a t4_a 3 7 3 NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 join t3 right join t4 on t3.a=t4.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join (`test`.`t1` join `test`.`t2` join `test`.`t3`) on(`test`.`t3`.`a` = `test`.`t4`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2232,11 +2232,11 @@ NULL NULL NULL 9 NULL NULL NULL 5 explain extended select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a from s1 join s2 join t3 join t4 using(a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE s2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE s2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`s2`.`b` AS `s2_b`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`s1` join `test`.`s2` join `test`.`t3` join `test`.`t4` where `test`.`t4`.`a` = `test`.`t3`.`a` select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a @@ -2253,11 +2253,11 @@ s1_b s2_b t3_a t4_a 3 7 7 7 explain extended select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a from s1 join s2 join t3 left join t4 using(a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE s2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE s2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`s2`.`b` AS `s2_b`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`s1` join `test`.`s2` join `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t3`.`a`) where 1 select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a @@ -2292,11 +2292,11 @@ s1_b s2_b t3_a t4_a 3 7 3 NULL explain extended select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a from s1 join s2 join t3 right join t4 using(a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE s2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE s2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`s2`.`b` AS `s2_b`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join (`test`.`s1` join `test`.`s2` join `test`.`t3`) on(`test`.`t3`.`a` = `test`.`t4`.`a`) where 1 select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a @@ -2316,11 +2316,11 @@ NULL NULL NULL 9 NULL NULL NULL 5 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 join t3 on t2.a=t3.a join t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` where `test`.`t3`.`a` = `test`.`t2`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2340,11 +2340,11 @@ t1_a t2_a t3_a t4_a 3 7 7 5 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 left join t3 on t2.a=t3.a join t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t2`.`a`) join `test`.`t4` where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2388,11 +2388,11 @@ t1_a t2_a t3_a t4_a 3 1 NULL 5 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 right join t3 on t2.a=t3.a join t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t3` left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) join `test`.`t4` where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2420,11 +2420,11 @@ NULL NULL 2 5 NULL NULL 3 5 explain extended select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from s1 join t2 join t3 using(a) join t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`s1` join `test`.`t2` join `test`.`t3` join `test`.`t4` where `test`.`t3`.`a` = `test`.`t2`.`a` select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2444,11 +2444,11 @@ s1_b t2_a t3_a t4_a 3 7 7 5 explain extended select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from s1 join t2 left join t3 using(a) join t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`s1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t2`.`a`) join `test`.`t4` where 1 select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2492,11 +2492,11 @@ s1_b t2_a t3_a t4_a 3 1 NULL 5 explain extended select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from s1 join t2 right join t3 using(a) join t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t3` left join (`test`.`s1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) join `test`.`t4` where 1 select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2524,11 +2524,11 @@ NULL NULL 2 5 NULL NULL 3 5 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` where `test`.`t4`.`a` = `test`.`t3`.`a` and `test`.`t2`.`a` = `test`.`t1`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2538,11 +2538,11 @@ t1_a t2_a t3_a t4_a 7 7 7 7 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t3`.`a`) where `test`.`t2`.`a` = `test`.`t1`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2556,11 +2556,11 @@ t1_a t2_a t3_a t4_a 7 7 3 NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join (`test`.`t1` join `test`.`t2` join `test`.`t3`) on(`test`.`t3`.`a` = `test`.`t4`.`a` and `test`.`t2`.`a` = `test`.`t1`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2573,11 +2573,11 @@ NULL NULL NULL 9 NULL NULL NULL 5 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 left join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t1`.`a`) join `test`.`t3` join `test`.`t4` where `test`.`t4`.`a` = `test`.`t3`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2588,11 +2588,11 @@ t1_a t2_a t3_a t4_a 3 NULL 7 7 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 left join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t1`.`a`) join `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t3`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2609,11 +2609,11 @@ t1_a t2_a t3_a t4_a 3 NULL 3 NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 left join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join (`test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t1`.`a`) join `test`.`t3`) on(`test`.`t3`.`a` = `test`.`t4`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2627,11 +2627,11 @@ NULL NULL NULL 9 NULL NULL NULL 5 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 right join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t2` left join `test`.`t1` on(`test`.`t1`.`a` = `test`.`t2`.`a`) join `test`.`t3` join `test`.`t4` where `test`.`t4`.`a` = `test`.`t3`.`a` select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2642,11 +2642,11 @@ t1_a t2_a t3_a t4_a NULL 1 7 7 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 right join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t2` left join `test`.`t1` on(`test`.`t1`.`a` = `test`.`t2`.`a`) join `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t3`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2663,11 +2663,11 @@ NULL 1 2 NULL NULL 1 3 NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 right join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join (`test`.`t2` left join `test`.`t1` on(`test`.`t1`.`a` = `test`.`t2`.`a`) join `test`.`t3`) on(`test`.`t3`.`a` = `test`.`t4`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2681,12 +2681,12 @@ NULL NULL NULL 9 NULL NULL NULL 5 explain extended select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from s1 join t1 left join t2 on s1.b=t2.a join t3 join t4 on t4.a=s1.b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`s1` join `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`s1`.`b`) join `test`.`t3` join `test`.`t4` where `test`.`t4`.`a` = `test`.`s1`.`b` select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2712,12 +2712,12 @@ s1_b t1_a t2_a t3_a t4_a 5 3 5 3 5 explain extended select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from s1 join t1 left join t2 on s1.b=t2.a join t3 left join t4 on t4.a=s1.b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`s1` join `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`s1`.`b`) join `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`s1`.`b`) where 1 select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2752,12 +2752,12 @@ s1_b t1_a t2_a t3_a t4_a 3 3 NULL 3 NULL explain extended select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from s1 join t1 left join t2 on s1.b=t2.a join t3 right join t4 on t4.a=s1.b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join (`test`.`s1` join `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t4`.`a`) join `test`.`t3`) on(`test`.`s1`.`b` = `test`.`t4`.`a`) where 1 select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2785,12 +2785,12 @@ NULL NULL NULL NULL 4 NULL NULL NULL NULL 9 explain extended select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from s1 join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE s2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE s2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`s2`.`b` AS `s2_b`,`test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t2` left join (`test`.`s1` join `test`.`s2` join `test`.`t1`) on(`test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`s2`.`b` = `test`.`s1`.`b`) join `test`.`t3` where 1 select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -2813,12 +2813,12 @@ NULL NULL NULL 1 7 NULL NULL NULL 1 3 explain extended select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from s1 left join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE s2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE s2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`s2`.`b` AS `s2_b`,`test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t2` left join (`test`.`s1` left join `test`.`s2` on(`test`.`s2`.`b` = `test`.`s1`.`b`) join `test`.`t1`) on(`test`.`t1`.`a` = `test`.`t2`.`a`) join `test`.`t3` where 1 select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -2847,12 +2847,12 @@ NULL NULL NULL 1 7 NULL NULL NULL 1 3 explain extended select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a from s1 right join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE s2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE s2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE s1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`s2`.`b` AS `s2_b`,`test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t2` left join (`test`.`s2` left join `test`.`s1` on(`test`.`s1`.`b` = `test`.`s2`.`b`) join `test`.`t1`) on(`test`.`t1`.`a` = `test`.`t2`.`a`) join `test`.`t3` where 1 select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a @@ -2881,11 +2881,11 @@ NULL NULL NULL 1 7 NULL NULL NULL 1 3 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1 join t2 right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t4`.`a`) left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2899,11 +2899,11 @@ NULL NULL NULL 9 NULL NULL NULL 5 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from (t1 join t2) right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t4`.`a`) left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2917,11 +2917,11 @@ NULL NULL NULL 9 NULL NULL NULL 5 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from (t1, t2) right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t4`.`a`) left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2951,11 +2951,11 @@ create table t5 (a int); insert into t5 values (3), (7), (9), (2); explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1, t2 join t3 left join t4 on t3.a=t4.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t3`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -2990,11 +2990,11 @@ t1_a t2_a t3_a t4_a 3 7 3 NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a from t1, t2 join t3 right join t4 on t3.a=t4.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t4` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t3`.`a` = `test`.`t4`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a @@ -3020,12 +3020,12 @@ t1_a t2_a t3_a t4_a 3 NULL NULL 5 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a, t5.a as t5_a from t1, t2 join t3 join t4 left join t5 on t4.a=t5.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t5 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a`,`test`.`t5`.`a` AS `t5_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` left join `test`.`t5` on(`test`.`t5`.`a` = `test`.`t4`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a, t5.a as t5_a @@ -3141,12 +3141,12 @@ t1_a t2_a t3_a t4_a t5_a 3 7 3 5 NULL explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a, t5.a as t5_a from t1, t2 join t3 join t4 right join t5 on t4.a=t5.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t5 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a`,`test`.`t5`.`a` AS `t5_a` from `test`.`t1` join `test`.`t5` left join (`test`.`t2` join `test`.`t3` join `test`.`t4`) on(`test`.`t4`.`a` = `test`.`t5`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a, t5.a as t5_a @@ -3214,12 +3214,12 @@ t1_a t2_a t3_a t4_a t5_a 3 NULL NULL NULL 2 explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a, t5.a as t5_a from t1 left join t2 on t1.a=t2.a, t3 join t4 right join t5 on t4.a=t5.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a`,`test`.`t5`.`a` AS `t5_a` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t1`.`a`) join `test`.`t5` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t4`.`a` = `test`.`t5`.`a`) where 1 select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a, t5.a as t5_a @@ -3272,9 +3272,9 @@ CREATE TABLE t2 (a int); INSERT INTO t2 (a) VALUES (1),(2),(3),(4); EXPLAIN SELECT t1.a FROM t1 NATURAL INNER JOIN t2 ORDER BY t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) SELECT t1.a FROM t1 NATURAL INNER JOIN t2 ORDER BY t1.a; a 1 @@ -3283,9 +3283,9 @@ a 4 EXPLAIN SELECT t1.a FROM t1 STRAIGHT_JOIN t2 USING(a) ORDER BY t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) SELECT t1.a FROM t1 STRAIGHT_JOIN t2 USING(a) ORDER BY t1.a; a 1 @@ -3294,9 +3294,9 @@ a 4 EXPLAIN SELECT t1.a FROM t1 NATURAL STRAIGHT_JOIN t2 ORDER BY t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) SELECT t1.a FROM t1 NATURAL STRAIGHT_JOIN t2 ORDER BY t1.a; a 1 @@ -3345,9 +3345,9 @@ t1 0 PRIMARY 1 pk A 1010 NULL NULL BTREE NO t1 0 a 1 a A 1010 NULL NULL YES BTREE NO # t1 must use eq_ref(t1.a=t0.a) and rows must be 1 (and not 45): explain select * from t0,t1 where t0.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 eq_ref a a 5 test.t0.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 NULL eq_ref a a 5 test.t0.a 1 drop table t0,t1; # # MDEV-21383: Possible range plan is not used under certain conditions @@ -3400,10 +3400,10 @@ t2.stationId = t1.stationId and (t1.stationid = 1 or t1.stationid = 2 or t1.stationid = 3) and key1 >0 and t2.key2=t3.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t2 range PRIMARY,key1,key2 PRIMARY 8 NULL 219 Using index condition; Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ref a a 5 test.t2.key2 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t2 NULL range PRIMARY,key1,key2 PRIMARY 8 NULL 219 Using index condition; Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ref a a 5 test.t2.key2 1 drop table t1,t2,t3; drop table t1000,t10,t03; # End of 10.3 tests diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result index 359739fecf8..747249f5e56 100644 --- a/mysql-test/main/join_cache.result +++ b/mysql-test/main/join_cache.result @@ -57,9 +57,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -87,10 +87,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE CountryLanguage NULL ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -135,9 +135,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -165,10 +165,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE CountryLanguage NULL ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (incremental, BNL join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -213,9 +213,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -243,10 +243,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE CountryLanguage NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -291,9 +291,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -321,10 +321,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE CountryLanguage NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (incremental, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -409,9 +409,9 @@ SELECT Country.Name, Country.Population, City.Name, City.Population FROM Country LEFT JOIN City ON City.Country=Country.Code AND City.Population > 5000000 WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City hash_range City_Population #hash#$hj:City_Population 3:4 world.Country.Code 24 Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE City NULL hash_range City_Population #hash#$hj:City_Population 3:4 world.Country.Code 24 Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join) SELECT Country.Name, Country.Population, City.Name, City.Population FROM Country LEFT JOIN City ON City.Country=Country.Code AND City.Population > 5000000 @@ -436,9 +436,9 @@ FROM Country LEFT JOIN City ON City.Country=Country.Code AND (City.Population > 5000000 OR City.Name LIKE 'Za%') WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City hash_index_merge City_Population,City_Name #hash#$hj:City_Population,City_Name 3:4,35 world.Country.Code 96 Using sort_union(City_Population,City_Name); Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE City NULL hash_index_merge City_Population,City_Name #hash#$hj:City_Population,City_Name 3:4,35 world.Country.Code 96 Using sort_union(City_Population,City_Name); Using where; Using join buffer (flat, BNLH join) SELECT Country.Name, Country.Population, City.Name, City.Population FROM Country LEFT JOIN City ON City.Country=Country.Code AND @@ -475,9 +475,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -505,10 +505,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE CountryLanguage NULL ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -553,9 +553,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -583,10 +583,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE CountryLanguage NULL ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (incremental, BNL join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -631,9 +631,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -661,10 +661,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE CountryLanguage NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -709,9 +709,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -739,10 +739,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE CountryLanguage NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (incremental, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -820,9 +820,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -850,10 +850,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where -1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE CountryLanguage hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (flat, BNLH join); Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE Country NULL hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE CountryLanguage NULL hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (flat, BNLH join); Using rowid filter SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -894,9 +894,9 @@ EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -922,9 +922,9 @@ FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage hash_ALL PRIMARY #hash#PRIMARY 33 world.Country.Code,const 984 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE CountryLanguage NULL hash_ALL PRIMARY #hash#PRIMARY 33 world.Country.Code,const 984 Using where; Using join buffer (flat, BNLH join) SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') @@ -1020,9 +1020,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -1050,10 +1050,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where -1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE CountryLanguage hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (incremental, BNLH join); Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE Country NULL hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE CountryLanguage NULL hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (incremental, BNLH join); Using rowid filter SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -1094,9 +1094,9 @@ EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -1122,9 +1122,9 @@ FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage hash_ALL PRIMARY #hash#PRIMARY 33 world.Country.Code,const 984 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE CountryLanguage NULL hash_ALL PRIMARY #hash#PRIMARY 33 world.Country.Code,const 984 Using where; Using join buffer (flat, BNLH join) SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') @@ -1214,9 +1214,9 @@ SELECT Country.Name, Country.Population, City.Name, City.Population FROM Country LEFT JOIN City ON City.Country=Country.Code AND City.Population > 5000000 WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range Name Name 52 NULL # Using index condition; Using where; Rowid-ordered scan -1 SIMPLE City hash_range Population,Country #hash#Country:Population 3:4 world.Country.Code # Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range Name Name 52 NULL # Using index condition; Using where; Rowid-ordered scan +1 SIMPLE City NULL hash_range Population,Country #hash#Country:Population 3:4 world.Country.Code # Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join) SELECT Country.Name, Country.Population, City.Name, City.Population FROM Country LEFT JOIN City ON City.Country=Country.Code AND City.Population > 5000000 @@ -1242,9 +1242,9 @@ FROM Country LEFT JOIN City ON City.Country=Country.Code AND (City.Population > 5000000 OR City.Name LIKE 'Za%') WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range Name Name 52 NULL 17 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE City hash_index_merge Population,Country,City_Name #hash#Country:Population,City_Name 3:4,35 world.Country.Code 96 Using sort_union(Population,City_Name); Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range Name Name 52 NULL 17 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE City NULL hash_index_merge Population,Country,City_Name #hash#Country:Population,City_Name 3:4,35 world.Country.Code 96 Using sort_union(Population,City_Name); Using where; Using join buffer (flat, BNLH join) SELECT Country.Name, Country.Population, City.Name, City.Population FROM Country LEFT JOIN City ON City.Country=Country.Code AND @@ -1279,9 +1279,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -1309,10 +1309,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE CountryLanguage NULL ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -1353,9 +1353,9 @@ EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -1381,9 +1381,9 @@ FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE CountryLanguage NULL eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') @@ -1476,9 +1476,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -1506,10 +1506,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE CountryLanguage NULL ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -1550,9 +1550,9 @@ EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -1578,9 +1578,9 @@ FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE CountryLanguage NULL eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') @@ -1673,9 +1673,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -1703,10 +1703,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan -1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE CountryLanguage NULL ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -1747,9 +1747,9 @@ EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -1775,9 +1775,9 @@ FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE CountryLanguage NULL eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') @@ -1870,9 +1870,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -1900,10 +1900,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan -1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE CountryLanguage NULL ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -1944,9 +1944,9 @@ EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -1972,9 +1972,9 @@ FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') WHERE Country.Population > 10000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE CountryLanguage NULL eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage) FROM Country LEFT JOIN CountryLanguage ON (CountryLanguage.Country=Country.Code AND Language='English') @@ -2071,9 +2071,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -2101,10 +2101,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where -1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE CountryLanguage hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (flat, BNLH join); Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE Country NULL hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE CountryLanguage NULL hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (flat, BNLH join); Using rowid filter SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -2145,9 +2145,9 @@ EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -2175,9 +2175,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -2205,10 +2205,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where -1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE CountryLanguage hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (incremental, BNLH join); Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE Country NULL hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE CountryLanguage NULL hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (incremental, BNLH join); Using rowid filter SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -2249,9 +2249,9 @@ EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -2279,9 +2279,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -2309,10 +2309,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE CountryLanguage NULL ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -2353,9 +2353,9 @@ EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -2383,9 +2383,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -2413,10 +2413,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE CountryLanguage NULL ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -2457,9 +2457,9 @@ EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -2487,9 +2487,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -2517,10 +2517,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan -1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE CountryLanguage NULL ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -2561,9 +2561,9 @@ EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -2591,9 +2591,9 @@ EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -2621,10 +2621,10 @@ CountryLanguage.Country=Country.Code AND City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan -1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE CountryLanguage NULL ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -2665,9 +2665,9 @@ EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -2744,9 +2744,9 @@ set join_buffer_size=384; EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND City.Population > 3000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Country Population 4 NULL # Using index condition; Rowid-ordered scan -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country # Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Country Population 4 NULL # Using index condition; Rowid-ordered scan +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country # Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND City.Population > 3000000; Name Name @@ -2898,18 +2898,18 @@ SELECT Country.Name, Country.Population, City.Name, City.Population FROM Country LEFT JOIN City ON City.Country=Country.Code AND City.Population > 5000000 WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range Name Name 302 NULL 15 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE City hash_range Population,Country #hash#Country:Population 3:4 world.Country.Code 24 Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range Name Name 302 NULL 15 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE City NULL hash_range Population,Country #hash#Country:Population 3:4 world.Country.Code 24 Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join) EXPLAIN SELECT Country.Name, Country.Population, City.Name, City.Population FROM Country LEFT JOIN City ON City.Country=Country.Code AND (City.Population > 5000000 OR City.Name LIKE 'Za%') WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country range Name Name 302 NULL 15 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE City hash_index_merge Population,Country,City_Name #hash#Country:Population,City_Name 3:4,35 world.Country.Code 96 Using sort_union(Population,City_Name); Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE Country NULL range Name Name 302 NULL 15 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE City NULL hash_index_merge Population,Country,City_Name #hash#Country:Population,City_Name 3:4,35 world.Country.Code 96 Using sort_union(Population,City_Name); Using where; Using join buffer (flat, BNLH join) set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set @@use_stat_tables=@save_use_stat_tables; set @@join_cache_level=@save_join_cache_level; @@ -3064,18 +3064,18 @@ t3.formatid = t4.formatid AND t4.formatclassid = t5.formatclassid AND t4.canaddtocapability = 'Y' AND t5.formattypeid = t6.formattypeid AND t6.formattypeid IN (2) AND (t3.formatid IN (31, 8, 76)) AND t1.metaid = t2.metaid AND t1.affiliateid = '2'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t6 system PRIMARY NULL NULL NULL 1 -1 SIMPLE t5 ref PRIMARY,t5_formattypeid t5_formattypeid 4 const 1 -1 SIMPLE t1 ref t1_affiliateid,t1_metaid t1_affiliateid 4 const 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.metaid 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t7 ref PRIMARY PRIMARY 4 test.t1.metaid 1 Using index -1 SIMPLE t8 eq_ref PRIMARY PRIMARY 4 test.t7.artistid 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t3 ref t3_metaid,t3_formatid,t3_metaidformatid t3_metaidformatid 4 test.t1.metaid 1 Using index condition; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t4 eq_ref PRIMARY,t4_formatclassid,t4_formats_idx PRIMARY 4 test.t3.formatid 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t9 index PRIMARY,t9_subgenreid,t9_metaid PRIMARY 8 NULL 2 Using where; Using index; Using join buffer (incremental, BNL join) -1 SIMPLE t10 eq_ref PRIMARY,t10_genreid PRIMARY 4 test.t9.subgenreid 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t10.genreid 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t6 NULL system PRIMARY NULL NULL NULL 1 +1 SIMPLE t5 NULL ref PRIMARY,t5_formattypeid t5_formattypeid 4 const 1 +1 SIMPLE t1 NULL ref t1_affiliateid,t1_metaid t1_affiliateid 4 const 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.metaid 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t7 NULL ref PRIMARY PRIMARY 4 test.t1.metaid 1 Using index +1 SIMPLE t8 NULL eq_ref PRIMARY PRIMARY 4 test.t7.artistid 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t3 NULL ref t3_metaid,t3_formatid,t3_metaidformatid t3_metaidformatid 4 test.t1.metaid 1 Using index condition; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t4 NULL eq_ref PRIMARY,t4_formatclassid,t4_formats_idx PRIMARY 4 test.t3.formatid 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t9 NULL index PRIMARY,t9_subgenreid,t9_metaid PRIMARY 8 NULL 2 Using where; Using index; Using join buffer (incremental, BNL join) +1 SIMPLE t10 NULL eq_ref PRIMARY,t10_genreid PRIMARY 4 test.t9.subgenreid 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t11 NULL eq_ref PRIMARY PRIMARY 4 test.t10.genreid 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT t1.uniquekey, t1.xml AS affiliateXml, t8.name AS artistName, t8.artistid, t11.name AS genreName, t11.genreid, t11.priority AS genrePriority, @@ -3127,10 +3127,10 @@ EXPLAIN SELECT a1<>a2, a1, a2, b2, b3, c3, SUBSTR(filler1,1,1) AS s1, SUBSTR(filler2,1,1) AS s2 FROM t1,t2,t3 WHERE a1=a2 AND b2=b3 AND MOD(c3,10)>7; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using where -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index -1 SIMPLE t3 ref idx idx 5 test.t2.b2 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 9 Using where +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index +1 SIMPLE t3 NULL ref idx idx 5 test.t2.b2 5 Using where SELECT a1<>a2, a1, a2, b2, b3, c3, SUBSTR(filler1,1,1) AS s1, SUBSTR(filler2,1,1) AS s2 FROM t1,t2,t3 WHERE a1=a2 AND b2=b3 AND MOD(c3,10)>7; @@ -3155,10 +3155,10 @@ EXPLAIN SELECT a1<>a2, a1, a2, b2, b3, c3, SUBSTR(filler1,1,1) AS s1, SUBSTR(filler2,1,1) AS s2 FROM t1,t2,t3 WHERE a1=a2 AND b2=b3 AND MOD(c3,10)>7; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using where -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index -1 SIMPLE t3 ref idx idx 5 test.t2.b2 5 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 9 Using where +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index +1 SIMPLE t3 NULL ref idx idx 5 test.t2.b2 5 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT a1<>a2, a1, a2, b2, b3, c3, SUBSTR(filler1,1,1) AS s1, SUBSTR(filler2,1,1) AS s2 FROM t1,t2,t3 WHERE a1=a2 AND b2=b3 AND MOD(c3,10)>7; @@ -3190,9 +3190,9 @@ Warnings: Warning 1292 Truncated incorrect join_buffer_size value: '32' set join_cache_level=8; EXPLAIN SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t1.b >= 30; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 3 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE t2 ref idx idx 5 test.t1.a 2 Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 3 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t2 NULL ref idx idx 5 test.t1.a 2 Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t1.b >= 30; a b a b 7 40 7 10 @@ -3213,9 +3213,9 @@ INSERT INTO t2 VALUES (4,10), (2,10), (2,30), (2,20), (4,20); INSERT INTO t2 VALUES (14,10), (12,10), (15,30), (12,20), (14,20); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a WHERE t2.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref i_a i_a 4 test.t1.a 2 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref i_a i_a 4 test.t1.a 2 Using where; Not exists SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a WHERE t2.b IS NULL; a a b 3 NULL NULL @@ -3224,9 +3224,9 @@ a a b SET join_cache_level=6; EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a WHERE t2.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref i_a i_a 4 test.t1.a 2 Using where; Not exists; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref i_a i_a 4 test.t1.a 2 Using where; Not exists; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a WHERE t2.b IS NULL; a a b 3 NULL NULL @@ -3251,9 +3251,9 @@ The following must not show "using join cache": explain select t1.a, count(t2.p) as count from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index; Using temporary; Using filesort -1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 8 Using index; Using temporary; Using filesort +1 SIMPLE t2 NULL ref i_a i_a 5 test.t1.a 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan select t1.a, count(t2.p) as count from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a; a count @@ -3303,9 +3303,9 @@ a b a c 1 10 1 100 2 20 NULL NULL explain select * from t1 left join t2 on t1.a=t2.a where t2.c=102 or t2.c is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.a 3 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 5 test.t1.a 3 Using where; Using join buffer (flat, BNLH join) select * from t1 left join t2 on t1.a=t2.a where t2.c=102 or t2.c is null; a b a c 3 30 3 102 @@ -3326,17 +3326,17 @@ a b 40 NULL 20 NULL explain select * from t1 left join t2 on (1=0) where a=40; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) select * from t1 left join t2 on (1=0) where a=40; a b 40 NULL set join_cache_level=0; explain select * from t1 left join t2 on (1=0); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where set join_cache_level=@save_join_cache_level; drop table t1, t2; # @@ -3370,9 +3370,9 @@ ANALYZE TABLE t1,t2; set join_cache_level=6; set join_buffer_size=1024; EXPLAIN SELECT AVG(c) FROM t1,t2 WHERE t1.a=t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2050 Using where -1 SIMPLE t2 ref idx idx 5 test.t1.a 640 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2050 Using where +1 SIMPLE t2 NULL ref idx idx 5 test.t1.a 640 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT AVG(c) FROM t1,t2 WHERE t1.a=t2.b; AVG(c) 5.0000 @@ -3410,10 +3410,10 @@ EXPLAIN SELECT COUNT(*) FROM t1,t2,t3 WHERE t1.a=t2.a AND t2.a=t3.a AND t1.b IS NULL AND t2.b IS NULL AND t3.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 16384 Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 16384 Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT COUNT(*) FROM t1,t2,t3 WHERE t1.a=t2.a AND t2.a=t3.a AND t1.b IS NULL AND t2.b IS NULL AND t3.b IS NULL; @@ -3475,10 +3475,10 @@ EXPLAIN SELECT t1.a, t2.a, t3.a, t2.b, t3.b, t3.val FROM (t1,t2) LEFT JOIN t3 ON (t1.a=t3.a AND t2.b=t3.b) WHERE t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 2 Using index -1 SIMPLE t2 ref PRIMARY PRIMARY 8 test.t1.a 1 Using index -1 SIMPLE t3 ref idx idx 16 test.t1.a,test.t2.b 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 2 Using index +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 8 test.t1.a 1 Using index +1 SIMPLE t3 NULL ref idx idx 16 test.t1.a,test.t2.b 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT t1.a, t2.a, t3.a, t2.b, t3.b, t3.val FROM (t1,t2) LEFT JOIN t3 ON (t1.a=t3.a AND t2.b=t3.b) WHERE t1.a=t2.a; @@ -3500,10 +3500,10 @@ EXPLAIN SELECT t1.a, t2.a, t3.a, t2.b, t3.b, t3.val FROM (t1,t2) LEFT JOIN t3 ON (t1.a=t3.a AND t2.b=t3.b) WHERE t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 2 Using index -1 SIMPLE t2 ref PRIMARY PRIMARY 8 test.t1.a 1 Using index -1 SIMPLE t3 ALL NULL NULL NULL NULL 24 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 2 Using index +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 8 test.t1.a 1 Using index +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 24 Using where; Using join buffer (flat, BNL join) SELECT t1.a, t2.a, t3.a, t2.b, t3.b, t3.val FROM (t1,t2) LEFT JOIN t3 ON (t1.a=t3.a AND t2.b=t3.b) WHERE t1.a=t2.a; @@ -3548,9 +3548,9 @@ f1 f2 f3 2 2 qwerty explain select t2.f1, t2.f2, t2.f3 from t1,t2 where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t2 NULL ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan show status like "Handler_icp%"; Variable_name Value Handler_icp_attempts 20 @@ -3565,9 +3565,9 @@ f1 f2 f3 2 2 qwerty explain select t2.f1, t2.f2, t2.f3 from t1,t2 where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t2 NULL ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan show status like "Handler_icp%"; Variable_name Value Handler_icp_attempts 40 @@ -3582,9 +3582,9 @@ f1 f2 f3 2 2 qwerty explain select t2.f1, t2.f2, t2.f3 from t1,t2 where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t2 NULL ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan show status like "Handler_icp%"; Variable_name Value Handler_icp_attempts 60 @@ -3599,9 +3599,9 @@ f1 f2 f3 2 2 qwerty explain select t2.f1, t2.f2, t2.f3 from t1,t2 where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t2 NULL ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan show status like "Handler_icp%"; Variable_name Value Handler_icp_attempts 80 @@ -3625,9 +3625,9 @@ set join_cache_level=6; explain select t1.id1, sum(t2.id2) from t1 join t2 on t1.id1=t2.id1 where t1.d=3 group by t1.id1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1 idx1 5 const 4 Using where; Using index; Using temporary; Using filesort -1 SIMPLE t2 ref idx2 idx2 5 test.t1.id1 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1 idx1 5 const 4 Using where; Using index; Using temporary; Using filesort +1 SIMPLE t2 NULL ref idx2 idx2 5 test.t1.id1 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan select t1.id1, sum(t2.id2) from t1 join t2 on t1.id1=t2.id1 where t1.d=3 group by t1.id1; id1 sum(t2.id2) @@ -3637,9 +3637,9 @@ id1 sum(t2.id2) explain select t1.id1 from t1 join t2 on t1.id1=t2.id1 where t1.d=3 and t2.id2 > 200 order by t1.id1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1 idx1 5 const 4 Using where; Using index; Using temporary; Using filesort -1 SIMPLE t2 ref idx2 idx2 5 test.t1.id1 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1 idx1 5 const 4 Using where; Using index; Using temporary; Using filesort +1 SIMPLE t2 NULL ref idx2 idx2 5 test.t1.id1 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan select t1.id1 from t1 join t2 on t1.id1=t2.id1 where t1.d=3 and t2.id2 > 200 order by t1.id1; id1 @@ -3693,11 +3693,11 @@ set join_cache_level=1; explain select t1.a, t1.b, t1.c, t1.d, t2.e, t3.f, t4.g from t1,t2,t3,t4 where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where -1 SIMPLE t2 ref idx idx 5 test.t1.b 1 -1 SIMPLE t4 ref idx idx 5 test.t1.c 1 -1 SIMPLE t3 ref idx idx 5 test.t1.d 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t2 NULL ref idx idx 5 test.t1.b 1 +1 SIMPLE t4 NULL ref idx idx 5 test.t1.c 1 +1 SIMPLE t3 NULL ref idx idx 5 test.t1.d 1 select t1.a, t1.b, t1.c, t1.d, t2.e, t3.f, t4.g from t1,t2,t3,t4 where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c; a b c d e f g @@ -3706,11 +3706,11 @@ set join_cache_level=6; explain select t1.a, t1.b, t1.c, t1.d, t2.e, t3.f, t4.g from t1,t2,t3,t4 where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where -1 SIMPLE t2 ref idx idx 5 test.t1.b 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t4 ref idx idx 5 test.t1.c 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t3 ref idx idx 5 test.t1.d 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t2 NULL ref idx idx 5 test.t1.b 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t4 NULL ref idx idx 5 test.t1.c 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t3 NULL ref idx idx 5 test.t1.d 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan select t1.a, t1.b, t1.c, t1.d, t2.e, t3.f, t4.g from t1,t2,t3,t4 where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c; a b c d e f g @@ -3757,12 +3757,12 @@ SELECT STRAIGHT_JOIN t1.id1, t1.num3, t3.text1, t3.id4, t2.id3, t4.dummy FROM t1 JOIN t2 JOIN t3 JOIN t4 JOIN t5 WHERE t1.id1=t5.id1 AND t1.id2=t5.id2 and t4.id2=t1.id2 AND t5.enum2='Active' AND t3.id4=t2.id4 AND t2.id3=t1.id3 AND t3.text1<'D'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 349 Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 8 test.t1.id3 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.id4 1 Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 8 test.t1.id2 1 Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 16 test.t1.id1,test.t1.id2 1 Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 349 Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 8 test.t1.id3 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 8 test.t2.id4 1 Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 8 test.t1.id2 1 Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 16 test.t1.id1,test.t1.id2 1 Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan SELECT STRAIGHT_JOIN t1.id1, t1.num3, t3.text1, t3.id4, t2.id3, t4.dummy FROM t1 JOIN t2 JOIN t3 JOIN t4 JOIN t5 WHERE t1.id1=t5.id1 AND t1.id2=t5.id2 and t4.id2=t1.id2 AND @@ -3857,9 +3857,9 @@ explain SELECT MAX(t1.int_key), t1.int_key FROM t1 STRAIGHT_JOIN t2 ORDER BY t1.int_key; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL int_key 4 NULL 14 Using index -1 SIMPLE t2 index NULL int_key 4 NULL 2 Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL int_key 4 NULL 14 Using index +1 SIMPLE t2 NULL index NULL int_key 4 NULL 2 Using index; Using join buffer (flat, BNL join) DROP TABLE t1,t2; SET join_cache_level=@save_join_cache_level; @@ -3894,9 +3894,9 @@ EXPLAIN SELECT MAX(t1.i) FROM t1 JOIN t2 ON t2.v ORDER BY t2.v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 Using index; Using join buffer (flat, BNL join) DROP TABLE t1,t2; # @@ -3929,10 +3929,10 @@ create table t3 (a int, b int); insert into t3 values (1,1),(2,2); set join_cache_level=1; explain select t1.* from t1,t2,t3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) select t1.* from t1,t2,t3; a b 1 1 @@ -3945,10 +3945,10 @@ a b 2 2 set join_cache_level=2; explain select t1.* from t1,t2,t3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join) select t1.* from t1,t2,t3; a b 1 1 @@ -3976,10 +3976,10 @@ INSERT INTO t3 VALUES (21,'j'),(22,'e'),(23,'f'),(24,'v'),(25,'x'),(26,'m'),(27,'o'); EXPLAIN SELECT t3.a FROM t1,t2,t3 WHERE t1.a = t3.a AND t1.b = t3.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 Using join buffer (incremental, BNL join) SELECT t3.a FROM t1,t2,t3 WHERE t1.a = t3.a AND t1.b = t3.b; a 27 @@ -4023,11 +4023,11 @@ EXPLAIN SELECT COUNT(*) FROM (t2 JOIN t1) LEFT JOIN (t3 JOIN t4 ON t3.id = t4.carrier_id) ON t3.carrier = t1.carrier; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.carrier 1 Using where -1 SIMPLE t4 ref carrier_id carrier_id 5 test.t3.id 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.carrier 1 Using where +1 SIMPLE t4 NULL ref carrier_id carrier_id 5 test.t3.id 2 Using index SET join_cache_level=@save_join_cache_level; DROP TABLE t1,t2,t3,t4; # @@ -4041,18 +4041,18 @@ INSERT INTO t2 VALUES (101,NULL),(151,200),(51,150),(251,350),(181,210),(101,150); set join_cache_level = 5; explain SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ref b b 5 test.t1.b 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ref b b 5 test.t1.b 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b; a NULL NULL set join_cache_level = 8; explain SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ref b b 5 test.t1.b 2 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ref b b 5 test.t1.b 2 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b; a NULL @@ -4061,9 +4061,9 @@ delete from t1; INSERT INTO t1 VALUES (NULL),(NULL); set join_cache_level = 5; explain SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ref b b 5 test.t1.b 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ref b b 5 test.t1.b 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b; a NULL @@ -4076,18 +4076,18 @@ INSERT INTO t2 VALUES (100,NULL),(150,"varchar"),(200,NULL),(250,"long long varc INSERT INTO t2 VALUES (100,NULL),(150,"long varchar"),(200,"varchar"),(250,"long long long varchar"); set join_cache_level = 5; explain SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ref b b 103 test.t1.b 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ref b b 103 test.t1.b 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b; a NULL NULL set join_cache_level = 8; explain SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ref b b 103 test.t1.b 2 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ref b b 103 test.t1.b 2 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b; a NULL @@ -4111,9 +4111,9 @@ set join_cache_level = 8; EXPLAIN SELECT t.a FROM t1 t, t1 s FORCE INDEX(idx) WHERE s.pk AND s.a >= t.pk AND s.b = t.c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE s ref idx idx 19 test.t.c 1 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE s NULL ref idx idx 19 test.t.c 1 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT t.a FROM t1 t, t1 s FORCE INDEX(idx) WHERE s.pk AND s.a >= t.pk AND s.b = t.c; a @@ -4134,10 +4134,10 @@ EXPLAIN SELECT t1.a FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.a) ON 0 WHERE t1.a OR t3.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 0 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 0 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 0 Using where; Using join buffer (incremental, BNL join) SELECT t1.a FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.a) ON 0 WHERE t1.a OR t3.a; @@ -4148,11 +4148,11 @@ EXPLAIN SELECT t1.a FROM t1 LEFT JOIN (t2 LEFT JOIN (t3 LEFT JOIN t4 ON 1) ON t2.a) ON 0 WHERE t1.a OR t4.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 0 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 0 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 0 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 0 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 0 Using where; Using join buffer (incremental, BNL join) SELECT t1.a FROM t1 LEFT JOIN (t2 LEFT JOIN (t3 LEFT JOIN t4 ON 1) ON t2.a) ON 0 WHERE t1.a OR t4.a; @@ -4206,10 +4206,10 @@ DELETE FROM t2 WHERE j > 10; EXPLAIN SELECT t1.i, t1.d, t1.v, t2.i, t2.d, t2.t, t2.v FROM t1,t2,t3 WHERE t3.u <='a' AND t2.j < 5 AND t3.v = t2.u; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 -1 SIMPLE t2 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 hash_ALL idx #hash#idx 3 test.t2.u 40 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL hash_ALL idx #hash#idx 3 test.t2.u 40 Using where; Using join buffer (flat, BNLH join) SELECT t1.i, t1.d, t1.v, t2.i, t2.d, t2.t, t2.v FROM t1,t2,t3 WHERE t3.u <='a' AND t2.j < 5 AND t3.v = t2.u; i d v i d t v @@ -4339,10 +4339,10 @@ EXPLAIN SELECT t2.v FROM t1, t2, t3 WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort -1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where -1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where +1 SIMPLE t1 NULL ref idx2 idx2 3 test.t3.v 5 Using where SELECT t2.v FROM t1, t2, t3 WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; @@ -4356,10 +4356,10 @@ EXPLAIN SELECT t2.v FROM t1, t2, t3 WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort -1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where -1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where +1 SIMPLE t1 NULL ref idx2 idx2 3 test.t3.v 5 Using where SELECT t2.v FROM t1, t2, t3 WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; @@ -4374,10 +4374,10 @@ EXPLAIN SELECT t2.v FROM t1, t2, t3 WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort -1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t1 NULL ref idx2 idx2 3 test.t3.v 5 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT t2.v FROM t1, t2, t3 WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; @@ -4391,10 +4391,10 @@ EXPLAIN SELECT t2.v FROM t1, t2, t3 WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort -1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t1 NULL ref idx2 idx2 3 test.t3.v 5 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT t2.v FROM t1, t2, t3 WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; @@ -4409,10 +4409,10 @@ EXPLAIN SELECT t2.v FROM t1, t2, t3 WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort -1 SIMPLE t3 hash_ALL PRIMARY,idx2 #hash#PRIMARY 4 test.t2.i 20 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE t1 hash_ALL idx2 #hash#idx2 3 test.t3.v 44 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort +1 SIMPLE t3 NULL hash_ALL PRIMARY,idx2 #hash#PRIMARY 4 test.t2.i 20 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t1 NULL hash_ALL idx2 #hash#idx2 3 test.t3.v 44 Using where; Using join buffer (incremental, BNLH join) SELECT t2.v FROM t1, t2, t3 WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; @@ -4426,10 +4426,10 @@ EXPLAIN SELECT t2.v FROM t1, t2, t3 WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort -1 SIMPLE t3 hash_ALL PRIMARY,idx2 #hash#PRIMARY 4 test.t2.i 20 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE t1 hash_ALL idx2 #hash#idx2 3 test.t3.v 44 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort +1 SIMPLE t3 NULL hash_ALL PRIMARY,idx2 #hash#PRIMARY 4 test.t2.i 20 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t1 NULL hash_ALL idx2 #hash#idx2 3 test.t3.v 44 Using where; Using join buffer (incremental, BNLH join) SELECT t2.v FROM t1, t2, t3 WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; @@ -4469,9 +4469,9 @@ INSERT INTO t2 VALUES ('gvdrodpedk',8,'chogvdrodp'), ('jichogvdro',7,'will'); EXPLAIN SELECT t2.i FROM t1,t2 WHERE t1.cu = t2.cl ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 -1 SIMPLE t1 ref cu cu 33 func 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 +1 SIMPLE t1 NULL ref cu cu 33 func 2 Using where; Using index SELECT t2.i FROM t1,t2 WHERE t1.cu = t2.cl ; i 6 @@ -4479,9 +4479,9 @@ i SET SESSION join_cache_level = 4; EXPLAIN SELECT t2.i FROM t1,t2 WHERE t1.cu = t2.cl ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 6 -1 SIMPLE t1 hash_index cu #hash#cu:cu 33:33 func 10 Using where; Using index; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 +1 SIMPLE t1 NULL hash_index cu #hash#cu:cu 33:33 func 10 Using where; Using index; Using join buffer (flat, BNLH join) SELECT t2.i FROM t1,t2 WHERE t1.cu = t2.cl ; i 6 @@ -4506,9 +4506,9 @@ SET SESSION join_cache_level = 4; SET SESSION join_buffer_size = 256; EXPLAIN SELECT t1.a, t2.c FROM t1,t2 WHERE t1.a=t2.a AND t2.b=99; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL idx NULL NULL NULL 15 Using where -1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t2.a 36 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL idx NULL NULL NULL 15 Using where +1 SIMPLE t1 NULL hash_ALL NULL #hash#$hj 5 test.t2.a 36 Using where; Using join buffer (flat, BNLH join) SELECT t1.a, t2.c FROM t1,t2 WHERE t1.a=t2.a AND t2.b=99; a c SET SESSION join_cache_level=@save_join_cache_level; @@ -4543,9 +4543,9 @@ INSERT INTO t2 VALUES ('fq', 5), ('abcdefjhjp',-1074397184); EXPLAIN SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = t1.v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where -1 SIMPLE t2 ref idx idx 13 test.t1.v 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t2 NULL ref idx idx 13 test.t1.v 3 SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = t1.v; v i abcdefjh 4 @@ -4553,9 +4553,9 @@ f 4 f 4 EXPLAIN SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = concat(t1.v, t1.v); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 -1 SIMPLE t2 ref idx idx 13 func 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 +1 SIMPLE t2 NULL ref idx idx 13 func 3 Using index condition SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = concat(t1.v, t1.v); v i f 5 @@ -4563,9 +4563,9 @@ f 5 SET SESSION join_cache_level = 4; EXPLAIN SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = t1.v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where -1 SIMPLE t2 hash_ALL idx #hash#idx 13 test.t1.v 36 Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 Using where +1 SIMPLE t2 NULL hash_ALL idx #hash#idx 13 test.t1.v 36 Using join buffer (flat, BNLH join) SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = t1.v; v i f 4 @@ -4573,9 +4573,9 @@ f 4 abcdefjh 4 EXPLAIN SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = concat(t1.v, t1.v); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 -1 SIMPLE t2 hash_ALL idx #hash#idx 13 func 36 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 +1 SIMPLE t2 NULL hash_ALL idx #hash#idx 13 func 36 Using where; Using join buffer (flat, BNLH join) SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = concat(t1.v, t1.v); v i f 5 @@ -4642,10 +4642,10 @@ SET SESSION join_cache_level = 4; EXPLAIN SELECT t3.i FROM t1,t2,t3 WHERE t1.v = t2.v AND t3.v = t1.v AND t2.i <> 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index idx idx 13 NULL 7 Using where; Using index -1 SIMPLE t2 hash_ALL idx #hash#idx 1003 test.t1.v 36 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE t3 hash_ALL idx #hash#idx 1002 func 64 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index idx idx 13 NULL 7 Using where; Using index +1 SIMPLE t2 NULL hash_ALL idx #hash#idx 1003 test.t1.v 36 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t3 NULL hash_ALL idx #hash#idx 1002 func 64 Using where; Using join buffer (incremental, BNLH join) SELECT t3.i FROM t1,t2,t3 WHERE t1.v = t2.v AND t3.v = t1.v AND t2.i <> 0; i @@ -4689,9 +4689,9 @@ pk a pk a SET SESSION join_cache_level = 4; EXPLAIN SELECT * FROM t1,t2 WHERE t2.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL idx NULL NULL NULL 3 Using where -1 SIMPLE t2 hash_ALL idx #hash#idx 515 test.t1.a 24 Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 Using where +1 SIMPLE t2 NULL hash_ALL idx #hash#idx 515 test.t1.a 24 Using join buffer (flat, BNLH join) SELECT * FROM t1,t2 WHERE t2.a=t1.a; pk a pk a 2 aa 30 aa @@ -4760,18 +4760,18 @@ SET SESSION optimizer_switch = 'outer_join_with_cache=on'; SET SESSION join_cache_level = 0; EXPLAIN SELECT * FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t1.a <> 0 OR t2.pk < 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 Using where SELECT * FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t1.a <>0 OR t2.pk < 9; pk a a 1 NULL NULL SET SESSION join_cache_level = 1; EXPLAIN SELECT * FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t1.a <> 0 OR t2.pk < 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) SELECT * FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t1.a <> 0 OR t2.pk < 9; pk a a 1 NULL NULL @@ -4800,12 +4800,12 @@ EXPLAIN EXTENDED SELECT * FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.c2 = t3.a3) ON t1.pk = t2.d2) LEFT JOIN t4 ON t1.a1 = t4.a4) LEFT JOIN t5 ON t3.a3 = t5.a5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ref idx idx 5 test.t1.a1 2 100.00 Using where -1 SIMPLE t5 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 NULL ref idx idx 5 test.t1.a1 2 100.00 Using where +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`d2` = `test`.`t1`.`pk` and `test`.`t3`.`a3` = `test`.`t2`.`c2`) left join `test`.`t4` on(`test`.`t4`.`a4` = `test`.`t1`.`a1` and `test`.`t1`.`a1` is not null) left join `test`.`t5` on(`test`.`t5`.`a5` = `test`.`t3`.`a3`) where 1 SELECT * @@ -4822,12 +4822,12 @@ EXPLAIN EXTENDED SELECT * FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.c2 = t3.a3) ON t1.pk = t2.d2) LEFT JOIN t4 ON t1.a1 = t4.a4) LEFT JOIN t5 ON t3.a3 = t5.a5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ref idx idx 5 test.t1.a1 2 100.00 Using where -1 SIMPLE t5 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ref idx idx 5 test.t1.a1 2 100.00 Using where +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`d2` = `test`.`t1`.`pk` and `test`.`t3`.`a3` = `test`.`t2`.`c2`) left join `test`.`t4` on(`test`.`t4`.`a4` = `test`.`t1`.`a1` and `test`.`t1`.`a1` is not null) left join `test`.`t5` on(`test`.`t5`.`a5` = `test`.`t3`.`a3`) where 1 SELECT * @@ -4844,12 +4844,12 @@ EXPLAIN EXTENDED SELECT * FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.c2 = t3.a3) ON t1.pk = t2.d2) LEFT JOIN t4 ON t1.a1 = t4.a4) LEFT JOIN t5 ON t3.a3 = t5.a5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ref idx idx 5 test.t1.a1 2 100.00 Using where -1 SIMPLE t5 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 NULL ref idx idx 5 test.t1.a1 2 100.00 Using where +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a1` AS `a1`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`c2` AS `c2`,`test`.`t2`.`d2` AS `d2`,`test`.`t3`.`pk` AS `pk`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`a4` AS `a4`,`test`.`t5`.`pk` AS `pk`,`test`.`t5`.`a5` AS `a5` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`d2` = `test`.`t1`.`pk` and `test`.`t3`.`a3` = `test`.`t2`.`c2`) left join `test`.`t4` on(`test`.`t4`.`a4` = `test`.`t1`.`a1` and `test`.`t1`.`a1` is not null) left join `test`.`t5` on(`test`.`t5`.`a5` = `test`.`t3`.`a3`) where 1 SELECT * @@ -4883,11 +4883,11 @@ SELECT * FROM t1 LEFT JOIN ((t2 JOIN t3 ON t2.a2 = t3.b3) JOIN t4 ON t4.b4 <> 0) ON t1.c1 = t3.c3 WHERE t3.a3 IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t3 hash_ALL PRIMARY #hash#$hj 5 test.t1.c1 1 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t3.b3 1 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t3 NULL hash_ALL PRIMARY #hash#$hj 5 test.t1.c1 1 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 5 test.t3.b3 1 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) SELECT * FROM t1 LEFT JOIN ((t2 JOIN t3 ON t2.a2 = t3.b3) JOIN t4 ON t4.b4 <> 0) ON t1.c1 = t3.c3 @@ -4899,11 +4899,11 @@ SELECT * FROM t1 LEFT JOIN ((t2 JOIN t3 ON t2.a2 = t3.b3) JOIN t4 ON t4.b4 <> 0) ON t1.c1 = t3.c3 WHERE t3.a3 IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 1 Using where SELECT * FROM t1 LEFT JOIN ((t2 JOIN t3 ON t2.a2 = t3.b3) JOIN t4 ON t4.b4 <> 0) ON t1.c1 = t3.c3 @@ -4925,10 +4925,10 @@ SET SESSION optimizer_switch = 'outer_join_with_cache=on'; SET SESSION join_cache_level = 6; EXPLAIN SELECT * FROM t1 LEFT JOIN t2 JOIN t3 ON t3.a3 = t2.a2 ON t3.b3 <> 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT * FROM t1 LEFT JOIN t2 JOIN t3 ON t3.a3 = t2.a2 ON t3.b3 <> 0; a1 a2 b2 a3 b3 0 2 1 2 1 @@ -4936,10 +4936,10 @@ a1 a2 b2 a3 b3 SET SESSION join_cache_level = 5; EXPLAIN SELECT * FROM t1 LEFT JOIN t2 JOIN t3 ON t3.a3 = t2.a2 ON t3.b3 <> 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 hash_ALL PRIMARY #hash#PRIMARY 4 test.t2.a2 1 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL hash_ALL PRIMARY #hash#PRIMARY 4 test.t2.a2 1 Using where; Using join buffer (incremental, BNLH join) SELECT * FROM t1 LEFT JOIN t2 JOIN t3 ON t3.a3 = t2.a2 ON t3.b3 <> 0; a1 a2 b2 a3 b3 0 2 1 2 1 @@ -4967,12 +4967,12 @@ EXPLAIN SELECT t4.a4, t5.b5 FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.a2 = t3.a3) ON t2.b2 = t1.a1) LEFT JOIN t4 ON t4.a4 <> 0) LEFT JOIN t5 ON t5.a5 = t2.a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 Using index -1 SIMPLE t4 ALL NULL NULL NULL NULL 1 Using where -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 1 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 Using index +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 1 Using where +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 Using where SELECT t4.a4, t5.b5 FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.a2 = t3.a3) ON t2.b2 = t1.a1) LEFT JOIN t4 ON t4.a4 <> 0) LEFT JOIN t5 ON t5.a5 = t2.a2; @@ -4984,12 +4984,12 @@ EXPLAIN SELECT t4.a4, t5.b5 FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.a2 = t3.a3) ON t2.b2 = t1.a1) LEFT JOIN t4 ON t4.a4 <> 0) LEFT JOIN t5 ON t5.a5 = t2.a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1 Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 Using index -1 SIMPLE t4 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 1 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 Using index +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT t4.a4, t5.b5 FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.a2 = t3.a3) ON t2.b2 = t1.a1) LEFT JOIN t4 ON t4.a4 <> 0) LEFT JOIN t5 ON t5.a5 = t2.a2; @@ -5016,9 +5016,9 @@ INSERT INTO t2 VALUES SET SESSION join_cache_level = 4; EXPLAIN SELECT * FROM t1,t2 WHERE t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where -1 SIMPLE t2 hash_ALL idx #hash#idx 35 test.t1.a 30 Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE t2 NULL hash_ALL idx #hash#idx 35 test.t1.a 30 Using join buffer (flat, BNLH join) SELECT * FROM t1,t2 WHERE t1.a=t2.a; pk a pk a 20 BBBB 1 Bbbb @@ -5059,9 +5059,9 @@ SET SESSION optimizer_switch = 'index_condition_pushdown=off'; EXPLAIN SELECT * FROM t1,t2 WHERE t1.f1 = t2.f4 AND (t1.f3 = 1 AND t2.f3 = 4 OR t1.f3 = 2 AND t2.f3 = 6); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Rowid-ordered scan -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Rowid-ordered scan +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) SELECT * FROM t1,t2 WHERE t1.f1 = t2.f4 AND (t1.f3 = 1 AND t2.f3 = 4 OR t1.f3 = 2 AND t2.f3 = 6); f1 f3 f3 f2 f4 @@ -5069,9 +5069,9 @@ SET SESSION optimizer_switch = 'index_condition_pushdown=on'; EXPLAIN SELECT * FROM t1,t2 WHERE t1.f1 = t2.f4 AND (t1.f3 = 1 AND t2.f3 = 4 OR t1.f3 = 2 AND t2.f3 = 6); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Rowid-ordered scan -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) SELECT * FROM t1,t2 WHERE t1.f1 = t2.f4 AND (t1.f3 = 1 AND t2.f3 = 4 OR t1.f3 = 2 AND t2.f3 = 6); f1 f3 f3 f2 f4 @@ -5092,9 +5092,9 @@ SET SESSION optimizer_switch='index_merge_sort_intersection=off'; SET SESSION optimizer_switch = 'index_condition_pushdown=off'; EXPLAIN SELECT * FROM t1,t2 WHERE t2.f3 = t1.f2 AND t1.f1 IN (9, 0, 100) ORDER BY t1.f2 LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range f1,f2 f2 13 NULL 10 Using where -1 SIMPLE t2 ref f3 f3 67 test.t1.f2 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range f1,f2 f2 13 NULL 10 Using where +1 SIMPLE t2 NULL ref f3 f3 67 test.t1.f2 2 Using where; Using index SELECT * FROM t1,t2 WHERE t2.f3 = t1.f2 AND t1.f1 IN (9, 0 ,100) ORDER BY t1.f2 LIMIT 1; f1 f2 f3 @@ -5102,9 +5102,9 @@ SET SESSION optimizer_switch=@local_optimizer_switch; SET SESSION optimizer_switch = 'index_condition_pushdown=on'; EXPLAIN SELECT * FROM t1,t2 WHERE t2.f3 = t1.f2 AND t1.f1 IN (9, 0 ,100) ORDER BY t1.f2 LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range f1,f2 f2 13 NULL 10 Using where -1 SIMPLE t2 ref f3 f3 67 test.t1.f2 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range f1,f2 f2 13 NULL 10 Using where +1 SIMPLE t2 NULL ref f3 f3 67 test.t1.f2 2 Using where; Using index SELECT * FROM t1,t2 WHERE t2.f3 = t1.f2 AND t1.f1 IN (9, 0 ,100) ORDER BY t1.f2 LIMIT 1; f1 f2 f3 @@ -5125,9 +5125,9 @@ INSERT INTO t2 VALUES SET SESSION join_cache_level = 1; EXPLAIN SELECT * FROM t1,t2 WHERE t1.a < 3 and t2.a IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index -1 SIMPLE t2 ref idx idx 5 const 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Using index +1 SIMPLE t2 NULL ref idx idx 5 const 4 Using index condition SELECT * FROM t1,t2 WHERE t1.a < 3 and t2.a IS NULL; a a b 1 NULL 10 @@ -5141,9 +5141,9 @@ a a b SET SESSION join_cache_level = 4; EXPLAIN SELECT * FROM t1,t2 WHERE t1.a < 3 and t2.a IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index -1 SIMPLE t2 hash_range idx #hash#idx:idx 5:5 const 4 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Using index +1 SIMPLE t2 NULL hash_range idx #hash#idx:idx 5:5 const 4 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join) SELECT * FROM t1,t2 WHERE t1.a < 3 and t2.a IS NULL; a a b 1 NULL 10 @@ -5171,9 +5171,9 @@ INSERT INTO t2 VALUES SET SESSION join_cache_level=3; EXPLAIN SELECT * FROM t1,t2 WHERE t2.f1 = t1.f1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL f1 NULL NULL NULL 2 Using where -1 SIMPLE t2 hash_ALL f1 #hash#f1 13 test.t1.f1 20 Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL f1 NULL NULL NULL 2 Using where +1 SIMPLE t2 NULL hash_ALL f1 #hash#f1 13 test.t1.f1 20 Using join buffer (flat, BNLH join) SELECT * FROM t1,t2 WHERE t2.f1 = t1.f1; f1 f2 f1 f2 SET SESSION join_cache_level=@save_join_cache_level; @@ -5193,9 +5193,9 @@ SET SESSION join_buffer_size = 256; SET SESSION join_cache_level = 4; EXPLAIN SELECT a FROM t1,t2 WHERE t2.v = t1.v ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t2 hash_ALL idx #hash#idx 4 test.t1.v 16 Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 NULL hash_ALL idx #hash#idx 4 test.t1.v 16 Using join buffer (flat, BNLH join) SELECT a FROM t1,t2 WHERE t2.v = t1.v ; a 11 @@ -5203,9 +5203,9 @@ a SET SESSION join_cache_level = 1; EXPLAIN SELECT a FROM t1,t2 WHERE t2.v = t1.v ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t2 ref idx idx 4 test.t1.v 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 NULL ref idx idx 4 test.t1.v 2 SELECT a FROM t1,t2 WHERE t2.v = t1.v ; a 11 @@ -5226,10 +5226,10 @@ SET SESSION join_cache_level = 0; EXPLAIN SELECT * FROM (SELECT DISTINCT * FROM t1) t WHERE t.a IN (SELECT t2.a FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; Start temporary -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 1 End temporary -2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 1 End temporary +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 Using temporary SELECT * FROM (SELECT DISTINCT * FROM t1) t WHERE t.a IN (SELECT t2.a FROM t2); a @@ -5238,10 +5238,10 @@ SET SESSION join_cache_level = 1; EXPLAIN SELECT * FROM (SELECT DISTINCT * FROM t1) t WHERE t.a IN (SELECT t2.a FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; Start temporary -1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 1 End temporary -2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 1 End temporary +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 Using temporary SELECT * FROM (SELECT DISTINCT * FROM t1) t WHERE t.a IN (SELECT t2.a FROM t2); a @@ -5261,9 +5261,9 @@ SET SESSION optimizer_switch='semijoin_with_cache=on'; SET SESSION join_cache_level=1; EXPLAIN SELECT * FROM t1 WHERE (t1.b) IN (SELECT c FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY t2 ref c c 5 test.t1.b 2 Using index; Start temporary; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY t2 NULL ref c c 5 test.t1.b 2 Using index; Start temporary; End temporary SELECT * FROM t1 WHERE (t1.b) IN (SELECT c FROM t2); a b 3914 17 @@ -5271,9 +5271,9 @@ a b SET SESSION join_cache_level=3; EXPLAIN SELECT * FROM t1 WHERE (t1.b) IN (SELECT c FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY t2 hash_index c #hash#c:c 5:5 test.t1.b 8 Using index; Start temporary; End temporary; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY t2 NULL hash_index c #hash#c:c 5:5 test.t1.b 8 Using index; Start temporary; End temporary; Using join buffer (flat, BNLH join) SELECT * FROM t1 WHERE (t1.b) IN (SELECT c FROM t2); a b 3914 17 @@ -5300,11 +5300,11 @@ EXPLAIN SELECT t1.* FROM t1,t2 WHERE (t1.b,t2.b) IN (SELECT t3.b,t4.b FROM t3,t4 WHERE t4.c=t3.b) AND t1.a = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 const idx idx 5 const 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL const idx idx 5 const 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (flat, BNL join) SELECT t1.* FROM t1,t2 WHERE (t1.b,t2.b) IN (SELECT t3.b,t4.b FROM t3,t4 WHERE t4.c=t3.b) AND t1.a = 1; @@ -5315,11 +5315,11 @@ EXPLAIN SELECT t1.* FROM t1,t2 WHERE (t1.b,t2.b) IN (SELECT t3.b,t4.b FROM t3,t4 WHERE t4.c=t3.b) AND t1.a = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 const idx idx 5 const 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY t3 hash_ALL NULL #hash#$hj 5 const 2 Using where; Start temporary; Using join buffer (flat, BNLH join) -1 PRIMARY t4 hash_ALL NULL #hash#$hj 10 const,test.t2.b 2 Using where; End temporary; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL const idx idx 5 const 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY t3 NULL hash_ALL NULL #hash#$hj 5 const 2 Using where; Start temporary; Using join buffer (flat, BNLH join) +1 PRIMARY t4 NULL hash_ALL NULL #hash#$hj 10 const,test.t2.b 2 Using where; End temporary; Using join buffer (incremental, BNLH join) SELECT t1.* FROM t1,t2 WHERE (t1.b,t2.b) IN (SELECT t3.b,t4.b FROM t3,t4 WHERE t4.c=t3.b) AND t1.a = 1; @@ -5343,12 +5343,12 @@ set @@optimizer_switch='derived_merge=off,derived_with_keys=off'; SET join_cache_level=0; EXPLAIN SELECT * FROM (SELECT t1.* FROM t1, t2) t WHERE t.a IN (SELECT * FROM t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 -2 DERIVED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM (SELECT t1.* FROM t1, t2) t WHERE t.a IN (SELECT * FROM t3); a 8 @@ -5380,10 +5380,10 @@ set @@optimizer_switch='firstmatch=off'; SET join_cache_level=1; EXPLAIN SELECT * FROM t1,t2 WHERE b IN (SELECT d FROM t3 WHERE c <= t2.c) ORDER BY a,d; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 Using temporary; Using filesort -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 Using temporary; Using filesort +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) SELECT * FROM t1,t2 WHERE b IN (SELECT d FROM t3 WHERE c <= t2.c) ORDER BY a,d; a b c d 8 10 8 10 @@ -5391,10 +5391,10 @@ a b c d SET join_cache_level=3; EXPLAIN SELECT * FROM t1,t2 WHERE b IN (SELECT d FROM t3 WHERE c <= t2.c); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY t3 hash_ALL NULL #hash#$hj 5 const 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t3 NULL hash_ALL NULL #hash#$hj 5 const 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) SELECT * FROM t1,t2 WHERE b IN (SELECT d FROM t3 WHERE c <= t2.c); a b c d 8 10 8 10 @@ -5402,10 +5402,10 @@ a b c d SET join_cache_level=3; EXPLAIN SELECT * FROM t1,t2 WHERE b IN (SELECT d FROM t3 WHERE c <= t2.c) ORDER BY a,d; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 Using temporary; Using filesort -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY t3 hash_ALL NULL #hash#$hj 5 const 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 Using temporary; Using filesort +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t3 NULL hash_ALL NULL #hash#$hj 5 const 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) SELECT * FROM t1,t2 WHERE b IN (SELECT d FROM t3 WHERE c <= t2.c) ORDER BY a,d; a b c d 8 10 8 10 @@ -5439,11 +5439,11 @@ SELECT * FROM t1,t2 WHERE t2.c IN (SELECT c FROM t3,t4 WHERE t4.a < 10) AND t2.a BETWEEN 4 and 5 ORDER BY t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t3 system NULL NULL NULL NULL 1 -1 PRIMARY t2 range a,c a 5 NULL 2 Using index condition; Using where; Using filesort -1 PRIMARY t4 ref c c 5 test.t2.c 2 Using where; Start temporary; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL range a,c a 5 NULL 2 Using index condition; Using where; Using filesort +1 PRIMARY t4 NULL ref c c 5 test.t2.c 2 Using where; Start temporary; End temporary SELECT * FROM t1,t2 WHERE t2.c IN (SELECT c FROM t3,t4 WHERE t4.a < 10) AND t2.a BETWEEN 4 and 5 @@ -5457,11 +5457,11 @@ SELECT * FROM t1,t2 WHERE t2.c IN (SELECT c FROM t3,t4 WHERE t4.a < 10) AND t2.a BETWEEN 4 and 5 ORDER BY t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 Using temporary; Using filesort -1 PRIMARY t3 system NULL NULL NULL NULL 1 -1 PRIMARY t2 range a,c a 5 NULL 2 Using index condition; Using where -1 PRIMARY t4 ref c c 5 test.t2.c 2 Using where; Start temporary; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 Using temporary; Using filesort +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL range a,c a 5 NULL 2 Using index condition; Using where +1 PRIMARY t4 NULL ref c c 5 test.t2.c 2 Using where; Start temporary; End temporary SELECT * FROM t1,t2 WHERE t2.c IN (SELECT c FROM t3,t4 WHERE t4.a < 10) AND t2.a BETWEEN 4 and 5 @@ -5476,11 +5476,11 @@ SELECT * FROM t1,t2 WHERE t2.c IN (SELECT c FROM t3,t4 WHERE t4.a < 10) AND t2.a BETWEEN 4 and 5 ORDER BY t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 Using temporary; Using filesort -1 PRIMARY t3 system NULL NULL NULL NULL 1 -1 PRIMARY t2 range a,c a 5 NULL 2 Using index condition; Using where -1 PRIMARY t4 ref c c 5 test.t2.c 2 Using where; Start temporary; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 Using temporary; Using filesort +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL range a,c a 5 NULL 2 Using index condition; Using where +1 PRIMARY t4 NULL ref c c 5 test.t2.c 2 Using where; Start temporary; End temporary SELECT * FROM t1,t2 WHERE t2.c IN (SELECT c FROM t3,t4 WHERE t4.a < 10) AND t2.a BETWEEN 4 and 5 @@ -5520,11 +5520,11 @@ insert into t4 values explain select name from t2, t1 where t1.uid in (select t4.uid from t4, t3 where t3.uid=1 and t4.uid=t3.fid) and t2.uid=t1.fid; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ref uid uid 5 const 4 Using where; Start temporary -1 PRIMARY t4 eq_ref PRIMARY PRIMARY 4 test.t3.fid 1 Using index -1 PRIMARY t1 ALL uid NULL NULL NULL 11 Using where; End temporary; Using join buffer (flat, BNL join) -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.fid 1 Using join buffer (flat, BKAH join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ref uid uid 5 const 4 Using where; Start temporary +1 PRIMARY t4 NULL eq_ref PRIMARY PRIMARY 4 test.t3.fid 1 Using index +1 PRIMARY t1 NULL ALL uid NULL NULL NULL 11 Using where; End temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.fid 1 Using join buffer (flat, BKAH join); Rowid-ordered scan select name from t2, t1 where t1.uid in (select t4.uid from t4, t3 where t3.uid=1 and t4.uid=t3.fid) and t2.uid=t1.fid; @@ -5559,11 +5559,11 @@ set join_cache_level=0; EXPLAIN SELECT * FROM t1 WHERE t1.i IN (SELECT t3.i FROM t3 LEFT JOIN t2 ON t2.i=t3.i); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 Using where SELECT * FROM t1 WHERE t1.i IN (SELECT t3.i FROM t3 LEFT JOIN t2 ON t2.i=t3.i); i @@ -5573,11 +5573,11 @@ set join_cache_level=2; EXPLAIN SELECT * FROM t1 WHERE t1.i IN (SELECT t3.i FROM t3 LEFT JOIN t2 ON t2.i=t3.i); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE t1.i IN (SELECT t3.i FROM t3 LEFT JOIN t2 ON t2.i=t3.i); i @@ -5605,10 +5605,10 @@ EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2 LEFT JOIN t3 ON t2.b = t3.b WHERE t2.c < 10 OR t3.c > 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 1 Using where SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2 LEFT JOIN t3 ON t2.b = t3.b WHERE t2.c < 10 OR t3.c > 1); @@ -5620,10 +5620,10 @@ EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2 LEFT JOIN t3 ON t2.b = t3.b WHERE t2.c < 10 OR t3.c > 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2 LEFT JOIN t3 ON t2.b = t3.b WHERE t2.c < 10 OR t3.c > 1); @@ -5653,10 +5653,10 @@ set join_buffer_size=4096*2; set join_cache_level=2; EXPLAIN SELECT * FROM t1, t2 LEFT JOIN t3 ON t2.b=t3.b WHERE t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * FROM t1, t2 LEFT JOIN t3 ON t2.b=t3.b WHERE t1.a=t2.a; a a b b c 3 3 30 30 300 @@ -5703,10 +5703,10 @@ set join_buffer_size=128; EXPLAIN SELECT 1 AS c FROM t1 NATURAL LEFT JOIN t2 LEFT OUTER JOIN t3 ON 1 GROUP BY elt(t1.col282,1,t1.col280); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) SELECT 1 AS c FROM t1 NATURAL LEFT JOIN t2 LEFT OUTER JOIN t3 ON 1 GROUP BY elt(t1.col282,1,t1.col280); c @@ -5726,10 +5726,10 @@ create table t2 like t1; insert into t2 select * from t1; #The following must use "Using temporary; Using filesort" and not just "Using filesort": explain select * from t0,t1 left join t2 on t1.b=t2.b order by t0.a, t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 system NULL NULL NULL NULL 1 Using temporary; Using filesort -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 -1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL system NULL NULL NULL NULL 1 Using temporary; Using filesort +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) drop table t0,t1,t2; # MDEV-6292: huge performance degradation for a sequence # of LEFT JOIN operations when using join buffer @@ -5855,35 +5855,35 @@ LEFT JOIN t2 c1 ON c1.parent_id = t.id AND c1.col2 = "val" LEFT JOIN t2 c27 ON c27.parent_id = t.id AND c27.col2 = "val" ORDER BY col1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t ALL NULL NULL NULL NULL 1 Using temporary; Using filesort -1 SIMPLE c1 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) -1 SIMPLE c2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c3 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c4 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c5 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c6 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c7 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c8 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c9 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c10 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c11 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c12 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c13 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c14 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c15 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c16 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c17 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c18 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c19 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c20 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c21 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c22 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c23 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c24 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c25 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c26 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE c27 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 Using temporary; Using filesort +1 SIMPLE c1 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) +1 SIMPLE c2 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c3 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c4 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c5 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c6 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c7 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c8 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c9 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c10 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c11 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c12 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c13 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c14 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c15 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c16 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c17 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c18 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c19 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c20 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c21 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c22 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c23 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c24 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c25 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c26 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c27 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) set join_buffer_size=@save_join_buffer_size; set join_cache_level=@save_join_cache_level; DROP TABLE t1,t2; @@ -5915,12 +5915,12 @@ i1 IN (SELECT (t4.e1) i1 FROM t4 LEFT JOIN t5 ON t4.e1 = t5.e1 LEFT JOIN (SELECT e1 FROM t2 ) AS d ON t4.e1 = d.e1) a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 128 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t4 ALL NULL NULL NULL NULL 128 -2 MATERIALIZED t5 hash_ALL NULL #hash#$hj 5 test.t4.e1 128 Using where; Using join buffer (flat, BNLH join) -2 MATERIALIZED t2 hash_ALL NULL #hash#$hj 5 test.t4.e1 128 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 128 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 128 +2 MATERIALIZED t5 NULL hash_ALL NULL #hash#$hj 5 test.t4.e1 128 Using where; Using join buffer (flat, BNLH join) +2 MATERIALIZED t2 NULL hash_ALL NULL #hash#$hj 5 test.t4.e1 128 Using where; Using join buffer (incremental, BNLH join) SELECT * FROM t1 WHERE i1 < 10 AND @@ -5974,11 +5974,11 @@ f1 f2 7 x EXPLAIN EXTENDED SELECT * FROM temp WHERE (f1,f2) IN (SELECT t1.i1, t1.v1 FROM (t2 JOIN t1 ON (t1.v1 = t2.v1))); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 1 100.00 -1 PRIMARY temp hash_ALL NULL #hash#$hj 9 test.t1.i1,test.t1.v1 7 100.00 Using where; Using join buffer (flat, BNLH join) -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 1 100.00 Using where -2 MATERIALIZED t2 hash_index v1 #hash#v1:v1 4:9 test.t1.v1 10 33.33 Using index; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 1 100.00 +1 PRIMARY temp NULL hash_ALL NULL #hash#$hj 9 test.t1.i1,test.t1.v1 7 100.00 Using where; Using join buffer (flat, BNLH join) +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +2 MATERIALIZED t2 NULL hash_index v1 #hash#v1:v1 4:9 test.t1.v1 10 33.33 Using index; Using join buffer (flat, BNLH join) Warnings: Note 1003 select `test`.`temp`.`f1` AS `f1`,`test`.`temp`.`f2` AS `f2` from `test`.`temp` semi join (`test`.`t2` join `test`.`t1`) where `test`.`temp`.`f1` = `test`.`t1`.`i1` and `test`.`t2`.`v1` = `test`.`t1`.`v1` and `test`.`temp`.`f2` = `test`.`t1`.`v1` DROP TABLE t1,t2,temp; @@ -5997,10 +5997,10 @@ set @counter=0; explain select count(*) from t1 straight_join t2 where c1 = c2-0 and c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -2 UNCACHEABLE SUBQUERY t3 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 UNCACHEABLE SUBQUERY t3 NULL system NULL NULL NULL NULL 1 select count(*) from t1 straight_join t2 where c1 = c2-0 and c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1); count(*) @@ -6013,10 +6013,10 @@ select count(*) from t1 straight_join t2 where c1 = c2-0 and c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1) and c2 / 2 = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -2 UNCACHEABLE SUBQUERY t3 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 UNCACHEABLE SUBQUERY t3 NULL system NULL NULL NULL NULL 1 set @counter=0; select count(*) from t1 straight_join t2 where c1 = c2-0 and @@ -6036,14 +6036,14 @@ create table t1 (a int); insert into t1 values (7), (9), (1), (4), (2), (3), (5), (8), (11), (6), (10); explain select count(*) from t1, t1 t2 where t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 -1 SIMPLE t2 ALL NULL NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) set join_buffer_space_limit=1024*8; explain select count(*) from t1, t1 t2 where t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 11 -1 SIMPLE t2 ALL NULL NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) set join_buffer_space_limit=@save_join_buffer_space_limit; drop table t1; # @@ -6055,9 +6055,9 @@ SET join_cache_level = 3; # - table db accessed with hash_ALL: explain SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.db WHERE Select_priv = PAGE_FAULTS_MINOR; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL Using where -1 SIMPLE db hash_ALL NULL #hash#$hj 1 information_schema.PROFILING.PAGE_FAULTS_MINOR 2 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE PROFILING NULL ALL NULL NULL NULL NULL NULL Using where +1 SIMPLE db NULL hash_ALL NULL #hash#$hj 1 information_schema.PROFILING.PAGE_FAULTS_MINOR 2 Using where; Using join buffer (flat, BNLH join) set join_cache_level=@save_join_cache_level; create table t1 (c1 date not null, key (c1)) engine=innodb; insert t1 values ('2017-12-27'); @@ -6102,11 +6102,11 @@ b c d e 1 2 2 2 2 4 NULL 2 EXPLAIN SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 hash_index d #hash#d:d 5:5 test.t2.c 2 Using where; Using index; Using join buffer (incremental, BNLH join) -1 SIMPLE t4 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t2.b 2 Using index; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL hash_index d #hash#d:d 5:5 test.t2.c 2 Using where; Using index; Using join buffer (incremental, BNLH join) +1 SIMPLE t4 NULL hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t2.b 2 Using index; Using join buffer (incremental, BNLH join) SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e; a b c d e 1 1 2 2 1 @@ -6115,11 +6115,11 @@ a b c d e 2 2 4 NULL 2 EXPLAIN SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e WHERE e IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 hash_index d #hash#d:d 5:5 test.t2.c 2 Using where; Using index; Using join buffer (incremental, BNLH join) -1 SIMPLE t4 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t2.b 2 Using where; Using index; Not exists; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL hash_index d #hash#d:d 5:5 test.t2.c 2 Using where; Using index; Using join buffer (incremental, BNLH join) +1 SIMPLE t4 NULL hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t2.b 2 Using where; Using index; Not exists; Using join buffer (incremental, BNLH join) SELECT * FROM t1 LEFT JOIN ( ( t2 LEFT JOIN t3 ON c = d ) JOIN t4 ) ON b = e WHERE e IS NULL; a b c d e @@ -6139,9 +6139,9 @@ a b c 5 6 4 explain select t1.a, t1.b, t1.c from t1,t2 where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.c,test.t1.a,test.t1.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 12 test.t1.c,test.t1.a,test.t1.b 1 Using index set join_cache_level=3; select t1.a, t1.b, t1.c from t1,t2 where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c; @@ -6150,9 +6150,9 @@ a b c 5 6 4 explain select t1.a, t1.b, t1.c from t1,t2 where t2.a = t1.a and t2.b = t1.b and t2.c=t1.c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t2 hash_index PRIMARY #hash#PRIMARY:PRIMARY 12:12 test.t1.c,test.t1.a,test.t1.b 2 Using index; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 NULL hash_index PRIMARY #hash#PRIMARY:PRIMARY 12:12 test.t1.c,test.t1.a,test.t1.b 2 Using index; Using join buffer (flat, BNLH join) drop table t1,t2; set join_cache_level=@save_join_cache_level; # diff --git a/mysql-test/main/join_cache.test b/mysql-test/main/join_cache.test index 4b659345db4..38ca79799ad 100644 --- a/mysql-test/main/join_cache.test +++ b/mysql-test/main/join_cache.test @@ -477,7 +477,7 @@ SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.P Country.Population > 10000000; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT Country.Name, Country.Population, City.Name, City.Population FROM Country LEFT JOIN City @@ -974,7 +974,7 @@ SELECT City.Name, Country.Name FROM City,Country set join_cache_level=8; set join_buffer_size=384; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND City.Population > 3000000; diff --git a/mysql-test/main/join_nested.result b/mysql-test/main/join_nested.result index b323190d8d5..77f39bbe3f2 100644 --- a/mysql-test/main/join_nested.result +++ b/mysql-test/main/join_nested.result @@ -74,10 +74,10 @@ LEFT JOIN (t3, t4) ON t2.b=t4.b WHERE t3.a=1 OR t3.c IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t4`.`b` = `test`.`t2`.`b`) where `test`.`t3`.`a` = 1 or `test`.`t3`.`c` is null SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b @@ -150,11 +150,11 @@ LEFT JOIN (t3, t4, t5) ON t2.b=t4.b WHERE t3.a>1 OR t3.c IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`b` = `test`.`t2`.`b`) where `test`.`t3`.`a` > 1 or `test`.`t3`.`c` is null SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b @@ -180,11 +180,11 @@ LEFT JOIN ON t2.b=t4.b WHERE (t3.a>1 OR t3.c IS NULL) AND (t5.a<3 OR t5.c IS NULL); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`b` = `test`.`t2`.`b`) where (`test`.`t3`.`a` > 1 or `test`.`t3`.`c` is null) and (`test`.`t5`.`a` < 3 or `test`.`t5`.`c` is null) SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b @@ -230,10 +230,10 @@ FROM (t6, t7) LEFT JOIN t8 ON t7.b=t8.b AND t6.b < 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t7`.`b` and `test`.`t6`.`b` < 10) where 1 SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b @@ -545,16 +545,16 @@ ON (t3.b=2 OR t3.c IS NULL) AND (t6.b=2 OR t6.c IS NULL) AND WHERE t0.a=1 AND t0.b=t1.b AND (t2.a >= 4 OR t2.c IS NULL); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b`) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null o r `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, @@ -640,17 +640,17 @@ t0.b=t1.b AND (t8.a < 1 OR t8.c IS NULL) AND (t8.b=t9.b OR t8.c IS NULL) AND (t9.a=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b`) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test` .`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null) SELECT t9.a,t9.b @@ -837,11 +837,11 @@ RIGHT JOIN t2 ON t3.a=1 AND t2.b=t4.b WHERE t1.a <= 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b`) where `test`.`t1`.`a` <= 2 INSERT INTO t2 VALUES (-1,9,0), (-3,10,0), (-2,8,0), (-4,11,0), (-5,15,0); @@ -852,11 +852,11 @@ FROM (t3,t4) LEFT JOIN (t1,t2) ON t3.a=1 AND t3.b=t2.b AND t2.b=t4.b AND t2.a>0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ref idx_b idx_b 5 test.t3.b 2 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t3`.`b` and `test`.`t2`.`b` = `test`.`t3`.`b` and `test`.`t2`.`a` > 0 and `test`.`t3`.`b` is not null) where 1 SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b @@ -908,17 +908,17 @@ t0.b=t1.b AND (t8.a < 1 OR t8.c IS NULL) AND (t8.b=t9.b OR t8.c IS NULL) AND (t9.a=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = ` test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t3`.`b` = `test`.`t4`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null) INSERT INTO t4 VALUES (-3,12,0), (-4,13,0), (-1,11,0), (-3,11,0), (-5,15,0); @@ -960,17 +960,17 @@ t0.b=t1.b AND (t8.a < 1 OR t8.c IS NULL) AND (t8.b=t9.b OR t8.c IS NULL) AND (t9.a=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where -1 SIMPLE t5 ALL idx_b NULL NULL NULL 7 100.00 Using where -1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 NULL ref idx_b idx_b 5 test.t2.b 2 100.00 Using where +1 SIMPLE t5 NULL ALL idx_b NULL NULL NULL 7 100.00 Using where +1 SIMPLE t7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t4`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`a` > 0)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is nul l) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null) INSERT INTO t8 VALUES (-3,12,0), (-1,14,0), (-5,15,0), (-1,11,0), (-4,13,0); @@ -1010,17 +1010,17 @@ t0.b=t1.b AND (t8.a < 1 OR t8.c IS NULL) AND (t8.b=t9.b OR t8.c IS NULL) AND (t9.a=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where -1 SIMPLE t5 ALL idx_b NULL NULL NULL 7 100.00 Using where -1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 NULL ref idx_b idx_b 5 test.t2.b 2 100.00 Using where +1 SIMPLE t5 NULL ALL idx_b NULL NULL NULL 7 100.00 Using where +1 SIMPLE t7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t8 NULL ref idx_b idx_b 5 test.t5.b 2 100.00 Using where Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t4`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t8`.`a` >= 0 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`a ` > 0)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null) INSERT INTO t1 VALUES (-1,133,0), (-2,12,0), (-3,11,0), (-5,15,0); @@ -1061,17 +1061,17 @@ t0.b=t1.b AND (t8.a < 1 OR t8.c IS NULL) AND (t8.b=t9.b OR t8.c IS NULL) AND (t9.a=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ref idx_a idx_a 5 const 2 100.00 -1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where -1 SIMPLE t5 ALL idx_b NULL NULL NULL 7 100.00 Using where -1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ref idx_a idx_a 5 const 2 100.00 +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t4 NULL ref idx_b idx_b 5 test.t2.b 2 100.00 Using where +1 SIMPLE t5 NULL ALL idx_b NULL NULL NULL 7 100.00 Using where +1 SIMPLE t7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t8 NULL ref idx_b idx_b 5 test.t5.b 2 100.00 Using where Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t 6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2 and `test`.`t1`.`a` > 0) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null) SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, @@ -1207,15 +1207,15 @@ INSERT INTO t2 VALUES (NULL), (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12), (13), (14), (15), (16), (17), (18), (19); INSERT INTO t3 VALUES (0), (1), (2), (3), (4), (5); EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON c < 3 and b = c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 21 Using index -1 SIMPLE t2 range b b 5 NULL 3 Using where; Using index -1 SIMPLE t3 ref c c 5 test.t2.b 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 21 Using index +1 SIMPLE t2 NULL range b b 5 NULL 3 Using where; Using index +1 SIMPLE t3 NULL ref c c 5 test.t2.b 2 Using index EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 21 Using index -1 SIMPLE t2 range b b 5 NULL 3 Using where; Using index -1 SIMPLE t3 ref c c 5 test.t2.b 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 21 Using index +1 SIMPLE t2 NULL range b b 5 NULL 3 Using where; Using index +1 SIMPLE t3 NULL ref c c 5 test.t2.b 2 Using index SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; a b c NULL 0 0 @@ -1283,10 +1283,10 @@ NULL 2 2 19 2 2 DELETE FROM t3; EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 const c NULL NULL NULL 1 Impossible ON condition -1 SIMPLE t2 const b NULL NULL NULL 1 Impossible ON condition -1 SIMPLE t1 index NULL a 5 NULL 21 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL const c NULL NULL NULL 1 Impossible ON condition +1 SIMPLE t2 NULL const b NULL NULL NULL 1 Impossible ON condition +1 SIMPLE t1 NULL index NULL a 5 NULL 21 Using index SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; a b c NULL NULL NULL @@ -1320,18 +1320,18 @@ c11 c21 4 NULL 5 NULL EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21; c11 c21 c31 4 NULL NULL 5 NULL NULL EXPLAIN SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 0 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 0 Using where DROP TABLE t1,t2,t3; CREATE TABLE t1 (goods int(12) NOT NULL, price varchar(128) NOT NULL); INSERT INTO t1 VALUES (23, 2340), (26, 9900); @@ -1456,29 +1456,29 @@ insert into t7 select * from t6; insert into t7 select * from t6; explain select * from t4 join t2 left join (t3 join t5 on t5.a=t3.b) on t3.a=t2.b where t4.a<=>t3.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL X -1 SIMPLE t3 ref a a 5 test.t2.b X Using where -1 SIMPLE t5 ref a a 5 test.t3.b X -1 SIMPLE t4 ref a a 5 test.t3.b X Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL X +1 SIMPLE t3 NULL ref a a 5 test.t2.b X Using where +1 SIMPLE t5 NULL ref a a 5 test.t3.b X +1 SIMPLE t4 NULL ref a a 5 test.t3.b X Using index condition explain select * from (t4 join t6 on t6.a=t4.b) right join t3 on t4.a=t3.b join t2 left join (t5 join t7 on t7.a=t5.b) on t5.a=t2.b where t3.a<=>t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL X -1 SIMPLE t3 ref a a 5 test.t2.b X Using index condition -1 SIMPLE t4 ref a a 5 test.t3.b X Using where -1 SIMPLE t6 ref a a 5 test.t4.b X -1 SIMPLE t5 ref a a 5 test.t2.b X Using where -1 SIMPLE t7 ref a a 5 test.t5.b X +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL X +1 SIMPLE t3 NULL ref a a 5 test.t2.b X Using index condition +1 SIMPLE t4 NULL ref a a 5 test.t3.b X Using where +1 SIMPLE t6 NULL ref a a 5 test.t4.b X +1 SIMPLE t5 NULL ref a a 5 test.t2.b X Using where +1 SIMPLE t7 NULL ref a a 5 test.t5.b X explain select * from t2 left join (t3 left join (t4 join t6 on t6.a=t4.b) on t4.a=t3.b join t5 on t5.a=t3.b) on t3.a=t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL X -1 SIMPLE t3 ref a a 5 test.t2.b X Using where -1 SIMPLE t5 ref a a 5 test.t3.b X -1 SIMPLE t4 ref a a 5 test.t5.a X Using where -1 SIMPLE t6 ref a a 5 test.t4.b X +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL X +1 SIMPLE t3 NULL ref a a 5 test.t2.b X Using where +1 SIMPLE t5 NULL ref a a 5 test.t3.b X +1 SIMPLE t4 NULL ref a a 5 test.t5.a X Using where +1 SIMPLE t6 NULL ref a a 5 test.t4.b X drop table t0, t1, t2, t3, t4, t5, t6, t7; create table t1 (a int); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -1489,10 +1489,10 @@ insert into t3 select * from t2; explain select * from t1 left join (t2 left join t3 on (t2.a = t3.a)) on (t1.a = t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 -1 SIMPLE t2 ref a a 5 test.t1.a 1 Using where -1 SIMPLE t3 ref a a 5 test.t1.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 NULL ref a a 5 test.t1.a 1 Using where +1 SIMPLE t3 NULL ref a a 5 test.t1.a 1 Using where drop table t1, t2, t3; CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, type varchar(10)); CREATE TABLE t2 (pid int NOT NULL PRIMARY KEY, type varchar(10)); @@ -1741,12 +1741,12 @@ JOIN t3 ON t3.package_id = t1.id) LEFT JOIN (t5 JOIN t4 ON t5.carrier_id = t4.id) ON t4.carrier = t1.carrier; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index package_id package_id 5 NULL 45 Using where; Using index -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.package_id 1 -1 SIMPLE t4 eq_ref PRIMARY,id PRIMARY 2 test.t1.carrier 1 Using where -1 SIMPLE t5 ref carrier_id carrier_id 5 test.t4.id 22 Using index -1 SIMPLE t3 ref package_id package_id 5 test.t2.package_id 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index package_id package_id 5 NULL 45 Using where; Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.package_id 1 +1 SIMPLE t4 NULL eq_ref PRIMARY,id PRIMARY 2 test.t1.carrier 1 Using where +1 SIMPLE t5 NULL ref carrier_id carrier_id 5 test.t4.id 22 Using index +1 SIMPLE t3 NULL ref package_id package_id 5 test.t2.package_id 1 Using index SELECT COUNT(*) FROM ((t2 JOIN t1 ON t2.package_id = t1.id) JOIN t3 ON t3.package_id = t1.id) @@ -1837,11 +1837,11 @@ SELECT * FROM t1 LEFT JOIN ((t2 LEFT JOIN t3 ON t2.a=t3.b) LEFT JOIN t4 ON t3.a=t4.b) ON t1.a=t2.a WHERE t3.a IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 1 100.00 Using where; Not exists -1 SIMPLE t4 ALL NULL NULL NULL NULL 0 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Not exists +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 0 0.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t1`.`a`) left join `test`.`t4` on(`test`.`t4`.`b` = `test`.`t3`.`a`)) on(`test`.`t2`.`a` = `test`.`t1`.`a`) where `test`.`t3`.`a` is null DROP TABLE t1,t2,t3,t4; @@ -1917,11 +1917,11 @@ ON (t1i.K1 = 1) AND OR (t2i.K2 IS NULL)) WHERE t2a.K1r = 1 AND t2i.K2 IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00 -1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index -1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1a NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t2a NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t1i NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t2i NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists Warnings: Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`test`.`t2a`.`K2` AS `K2`,`test`.`t2a`.`K1r` AS `K1r`,`test`.`t2a`.`rowTimestamp` AS `rowTimestamp`,`test`.`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on(`test`.`t2i`.`K1r` = 1)) on(`test`.`t1i`.`K1` = 1 and (`test`.`t2i`.`K1r` = 1 and `test`.`t2i`.`rowTimestamp` > `test`.`t2a`.`rowTimestamp` or `test`.`t2i`.`rowTimestamp` = `test`.`t2a`.`rowTimestamp` and `test`.`t2i`.`K2` > `test`.`t2a`.`K2` or `test`.`t2i`.`K2` is null)) where `test`.`t2a`.`K1r` = 1 and `test`.`t2i`.`K2` is null CREATE VIEW v1 AS @@ -1956,11 +1956,11 @@ OR (t2b.K2 IS NULL) WHERE t1a.K1 = 1 AND t2b.K2 IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00 -1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index -1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1a NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t2a NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t1i NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t2i NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists Warnings: Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`t2a`.`K2` AS `K2`,`t2a`.`K1r` AS `K1r`,`t2a`.`rowTimestamp` AS `rowTimestamp`,`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on(`test`.`t2i`.`K1r` = 1)) on(`test`.`t1i`.`K1` = 1 and (`test`.`t2i`.`K1r` = 1 and `test`.`t2i`.`rowTimestamp` > `t2a`.`rowTimestamp` or `test`.`t2i`.`rowTimestamp` = `t2a`.`rowTimestamp` and `test`.`t2i`.`K2` > `t2a`.`K2` or `test`.`t2i`.`K2` is null)) where `t2a`.`K1r` = 1 and `test`.`t2i`.`K2` is null DROP VIEW v1; @@ -1990,10 +1990,10 @@ pk c1 i1 explain extended SELECT t3.* FROM t3 LEFT JOIN t1 LEFT JOIN t2 ON t1.i1 = t2.i1 ON t3.i1 = t1.i1 WHERE t2.pk < 13 OR t3.i1 IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 18 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 0.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 18 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 0 0.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t3`.`pk` AS `pk`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`i1` AS `i1` from `test`.`t3` left join (`test`.`t1` left join `test`.`t2` on(`test`.`t2`.`i1` = `test`.`t3`.`i1`)) on(`test`.`t1`.`i1` = `test`.`t3`.`i1`) where `test`.`t2`.`pk` < 13 or `test`.`t3`.`i1` is null DROP TABLE t1,t2,t3; diff --git a/mysql-test/main/join_nested.test b/mysql-test/main/join_nested.test index 864218371f4..e3b439d8b25 100644 --- a/mysql-test/main/join_nested.test +++ b/mysql-test/main/join_nested.test @@ -902,15 +902,15 @@ create table t7 like t6; insert into t7 select * from t6; insert into t7 select * from t6; ---replace_column 9 X +--replace_column 10 X explain select * from t4 join t2 left join (t3 join t5 on t5.a=t3.b) on t3.a=t2.b where t4.a<=>t3.b; ---replace_column 9 X +--replace_column 10 X explain select * from (t4 join t6 on t6.a=t4.b) right join t3 on t4.a=t3.b join t2 left join (t5 join t7 on t7.a=t5.b) on t5.a=t2.b where t3.a<=>t2.b; ---replace_column 9 X +--replace_column 10 X explain select * from t2 left join (t3 left join (t4 join t6 on t6.a=t4.b) on t4.a=t3.b join t5 on t5.a=t3.b) on t3.a=t2.b; diff --git a/mysql-test/main/join_nested_jcl6.result b/mysql-test/main/join_nested_jcl6.result index f7d0242244d..e03d266d2e7 100644 --- a/mysql-test/main/join_nested_jcl6.result +++ b/mysql-test/main/join_nested_jcl6.result @@ -83,10 +83,10 @@ LEFT JOIN (t3, t4) ON t2.b=t4.b WHERE t3.a=1 OR t3.c IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where `test`.`t3`.`a` = 1 or `test`.`t3`.`c` is null SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b @@ -159,11 +159,11 @@ LEFT JOIN (t3, t4, t5) ON t2.b=t4.b WHERE t3.a>1 OR t3.c IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where `test`.`t3`.`a` > 1 or `test`.`t3`.`c` is null SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b @@ -189,11 +189,11 @@ LEFT JOIN ON t2.b=t4.b WHERE (t3.a>1 OR t3.c IS NULL) AND (t5.a<3 OR t5.c IS NULL); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b` from `test`.`t2` left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where (`test`.`t3`.`a` > 1 or `test`.`t3`.`c` is null) and (`test`.`t5`.`a` < 3 or `test`.`t5`.`c` is null) SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b @@ -239,10 +239,10 @@ FROM (t6, t7) LEFT JOIN t8 ON t7.b=t8.b AND t6.b < 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t7.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t8 NULL hash_ALL NULL #hash#$hj 5 test.t7.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) Warnings: Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t7`.`b` and `test`.`t6`.`b` < 10 and `test`.`t7`.`b` is not null) where 1 SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b @@ -554,16 +554,16 @@ ON (t3.b=2 OR t3.c IS NULL) AND (t6.b=2 OR t6.c IS NULL) AND WHERE t0.a=1 AND t0.b=t1.b AND (t2.a >= 4 OR t2.c IS NULL); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) -1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t1 NULL hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t7 NULL hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t8 NULL hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null ) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, @@ -649,17 +649,17 @@ t0.b=t1.b AND (t8.a < 1 OR t8.c IS NULL) AND (t8.b=t9.b OR t8.c IS NULL) AND (t9.a=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t1 NULL hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t7 NULL hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t8 NULL hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and ( `test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null) SELECT t9.a,t9.b @@ -846,11 +846,11 @@ RIGHT JOIN t2 ON t3.a=1 AND t2.b=t4.b WHERE t1.a <= 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) where `test`.`t1`.`a` <= 2 INSERT INTO t2 VALUES (-1,9,0), (-3,10,0), (-2,8,0), (-4,11,0), (-5,15,0); @@ -861,11 +861,11 @@ FROM (t3,t4) LEFT JOIN (t1,t2) ON t3.a=1 AND t3.b=t2.b AND t2.b=t4.b AND t2.a>0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) -1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ref idx_b idx_b 5 test.t3.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t3`.`b` and `test`.`t2`.`b` = `test`.`t3`.`b` and `test`.`t2`.`a` > 0 and `test`.`t3`.`b` is not null) where 1 SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b @@ -917,17 +917,17 @@ t0.b=t1.b AND (t8.a < 1 OR t8.c IS NULL) AND (t8.b=t9.b OR t8.c IS NULL) AND (t9.a=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE t5 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t1 NULL hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t7 NULL hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t8 NULL hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL hash_ALL NULL #hash#$hj 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test` .`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t3`.`b` = `test`.`t4`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t9`.`b` = `test`.`t8`.`b` or `test`.`t8`.`c` is null) INSERT INTO t4 VALUES (-3,12,0), (-4,13,0), (-1,11,0), (-3,11,0), (-5,15,0); @@ -969,17 +969,17 @@ t0.b=t1.b AND (t8.a < 1 OR t8.c IS NULL) AND (t8.b=t9.b OR t8.c IS NULL) AND (t9.a=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t5 ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t1 NULL hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ref idx_b idx_b 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t5 NULL ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t7 NULL hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t8 NULL hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t4`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`a` > 0 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null) INSERT INTO t8 VALUES (-3,12,0), (-1,14,0), (-5,15,0), (-1,11,0), (-4,13,0); @@ -1019,17 +1019,17 @@ t0.b=t1.b AND (t8.a < 1 OR t8.c IS NULL) AND (t8.b=t9.b OR t8.c IS NULL) AND (t9.a=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t5 ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t1 NULL hash_ALL NULL #hash#$hj 5 test.t0.b 3 100.00 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ref idx_b idx_b 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t5 NULL ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t7 NULL hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t8 NULL ref idx_b idx_b 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`a` > 0 and `test`.`t4`.`a` > 0 and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t8`.`a` >= 0 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`a ` > 0 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and (`test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null) INSERT INTO t1 VALUES (-1,133,0), (-2,12,0), (-3,11,0), (-5,15,0); @@ -1070,17 +1070,17 @@ t0.b=t1.b AND (t8.a < 1 OR t8.c IS NULL) AND (t8.b=t9.b OR t8.c IS NULL) AND (t9.a=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ref idx_a idx_a 5 const 2 100.00 -1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t5 ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ref idx_a idx_a 5 const 2 100.00 +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ref idx_b idx_b 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t5 NULL ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t7 NULL hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t8 NULL ref idx_b idx_b 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = 1 and `test`.`t4`.`b` = `test`.`t2`.`b` and `test`.`t2`.`b` is not null) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(`test`.`t8`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` < 10 and `test`.`t5`.`b` is not null)) on(`test`.`t7`.`b` = `test`.`t5`.`b` and `test`.`t6`.`b` >= 2 and `test`.`t5`.`b` is not null)) on((`test`.`t3`.`b` = 2 or `test`.`t3`.`c` is null) and ( `test`.`t6`.`b` = 2 or `test`.`t6`.`c` is null) and (`test`.`t5`.`b` = `test`.`t0`.`b` or `test`.`t3`.`c` is null or `test`.`t6`.`c` is null or `test`.`t8`.`c` is null) and `test`.`t1`.`a` <> 2 and `test`.`t1`.`a` > 0) join `test`.`t9` where `test`.`t0`.`a` = 1 and `test`.`t1`.`b` = `test`.`t0`.`b` and `test`.`t9`.`a` = 1 and (`test`.`t2`.`a` >= 4 or `test`.`t2`.`c` is null) and (`test`.`t3`.`a` < 5 or `test`.`t3`.`c` is null) and (`test`.`t4`.`b` = `test`.`t3`.`b` or `test`.`t3`.`c` is null or `test`.`t4`.`c` is null) and (`test`.`t5`.`a` >= 2 or `test`.`t5`.`c` is null) and (`test`.`t6`.`a` >= 4 or `test`.`t6`.`c` is null) and (`test`.`t7`.`a` <= 2 or `test`.`t7`.`c` is null) and (`test`.`t8`.`a` < 1 or `test`.`t8`.`c` is null) and (`test`.`t8`.`b` = `test`.`t9`.`b` or `test`.`t8`.`c` is null) SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, @@ -1216,15 +1216,15 @@ INSERT INTO t2 VALUES (NULL), (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12), (13), (14), (15), (16), (17), (18), (19); INSERT INTO t3 VALUES (0), (1), (2), (3), (4), (5); EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON c < 3 and b = c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 21 Using index -1 SIMPLE t2 range b b 5 NULL 3 Using where; Using index -1 SIMPLE t3 ref c c 5 test.t2.b 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 21 Using index +1 SIMPLE t2 NULL range b b 5 NULL 3 Using where; Using index +1 SIMPLE t3 NULL ref c c 5 test.t2.b 2 Using index EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 21 Using index -1 SIMPLE t2 range b b 5 NULL 3 Using where; Using index -1 SIMPLE t3 ref c c 5 test.t2.b 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 21 Using index +1 SIMPLE t2 NULL range b b 5 NULL 3 Using where; Using index +1 SIMPLE t3 NULL ref c c 5 test.t2.b 2 Using index SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; a b c NULL 0 0 @@ -1292,10 +1292,10 @@ NULL 2 2 19 2 2 DELETE FROM t3; EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 const c NULL NULL NULL 1 Impossible ON condition -1 SIMPLE t2 const b NULL NULL NULL 1 Impossible ON condition -1 SIMPLE t1 index NULL a 5 NULL 21 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL const c NULL NULL NULL 1 Impossible ON condition +1 SIMPLE t2 NULL const b NULL NULL NULL 1 Impossible ON condition +1 SIMPLE t1 NULL index NULL a 5 NULL 21 Using index SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; a b c NULL NULL NULL @@ -1329,18 +1329,18 @@ c11 c21 4 NULL 5 NULL EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21; c11 c21 c31 4 NULL NULL 5 NULL NULL EXPLAIN SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.c11 0 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.c11 0 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 5 test.t1.c11 0 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t3 NULL hash_ALL NULL #hash#$hj 5 test.t1.c11 0 Using where; Using join buffer (incremental, BNLH join) DROP TABLE t1,t2,t3; CREATE TABLE t1 (goods int(12) NOT NULL, price varchar(128) NOT NULL); INSERT INTO t1 VALUES (23, 2340), (26, 9900); @@ -1465,29 +1465,29 @@ insert into t7 select * from t6; insert into t7 select * from t6; explain select * from t4 join t2 left join (t3 join t5 on t5.a=t3.b) on t3.a=t2.b where t4.a<=>t3.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL X -1 SIMPLE t3 ref a a 5 test.t2.b X Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t5 ref a a 5 test.t3.b X Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t4 ref a a 5 test.t3.b X Using index condition(BKA); Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL X +1 SIMPLE t3 NULL ref a a 5 test.t2.b X Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t5 NULL ref a a 5 test.t3.b X Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t4 NULL ref a a 5 test.t3.b X Using index condition(BKA); Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan explain select * from (t4 join t6 on t6.a=t4.b) right join t3 on t4.a=t3.b join t2 left join (t5 join t7 on t7.a=t5.b) on t5.a=t2.b where t3.a<=>t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL X -1 SIMPLE t3 ref a a 5 test.t2.b X Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t4 ref a a 5 test.t3.b X Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t6 ref a a 5 test.t4.b X Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t5 ref a a 5 test.t2.b X Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t7 ref a a 5 test.t5.b X Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL X +1 SIMPLE t3 NULL ref a a 5 test.t2.b X Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t4 NULL ref a a 5 test.t3.b X Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t6 NULL ref a a 5 test.t4.b X Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t5 NULL ref a a 5 test.t2.b X Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t7 NULL ref a a 5 test.t5.b X Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan explain select * from t2 left join (t3 left join (t4 join t6 on t6.a=t4.b) on t4.a=t3.b join t5 on t5.a=t3.b) on t3.a=t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL X -1 SIMPLE t3 ref a a 5 test.t2.b X Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t5 ref a a 5 test.t3.b X Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t4 ref a a 5 test.t5.a X Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t6 ref a a 5 test.t4.b X Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL X +1 SIMPLE t3 NULL ref a a 5 test.t2.b X Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t5 NULL ref a a 5 test.t3.b X Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t4 NULL ref a a 5 test.t5.a X Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t6 NULL ref a a 5 test.t4.b X Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan drop table t0, t1, t2, t3, t4, t5, t6, t7; create table t1 (a int); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -1498,10 +1498,10 @@ insert into t3 select * from t2; explain select * from t1 left join (t2 left join t3 on (t2.a = t3.a)) on (t1.a = t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 -1 SIMPLE t2 ref a a 5 test.t1.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t3 ref a a 5 test.t1.a 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 NULL ref a a 5 test.t1.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t3 NULL ref a a 5 test.t1.a 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan drop table t1, t2, t3; CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, type varchar(10)); CREATE TABLE t2 (pid int NOT NULL PRIMARY KEY, type varchar(10)); @@ -1750,12 +1750,12 @@ JOIN t3 ON t3.package_id = t1.id) LEFT JOIN (t5 JOIN t4 ON t5.carrier_id = t4.id) ON t4.carrier = t1.carrier; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index package_id package_id 5 NULL 45 Using where; Using index -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.package_id 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t4 eq_ref PRIMARY,id PRIMARY 2 test.t1.carrier 1 Using where -1 SIMPLE t5 ref carrier_id carrier_id 5 test.t4.id 22 Using index -1 SIMPLE t3 ref package_id package_id 5 test.t2.package_id 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index package_id package_id 5 NULL 45 Using where; Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.package_id 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t4 NULL eq_ref PRIMARY,id PRIMARY 2 test.t1.carrier 1 Using where +1 SIMPLE t5 NULL ref carrier_id carrier_id 5 test.t4.id 22 Using index +1 SIMPLE t3 NULL ref package_id package_id 5 test.t2.package_id 1 Using index SELECT COUNT(*) FROM ((t2 JOIN t1 ON t2.package_id = t1.id) JOIN t3 ON t3.package_id = t1.id) @@ -1846,11 +1846,11 @@ SELECT * FROM t1 LEFT JOIN ((t2 LEFT JOIN t3 ON t2.a=t3.b) LEFT JOIN t4 ON t3.a=t4.b) ON t1.a=t2.a WHERE t3.a IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 4 test.t1.a 1 100.00 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.a 1 100.00 Using where; Not exists; Using join buffer (incremental, BNLH join) -1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t3.a 0 0.00 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 4 test.t1.a 1 100.00 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t3 NULL hash_ALL NULL #hash#$hj 5 test.t1.a 1 100.00 Using where; Not exists; Using join buffer (incremental, BNLH join) +1 SIMPLE t4 NULL hash_ALL NULL #hash#$hj 5 test.t3.a 0 0.00 Using where; Using join buffer (incremental, BNLH join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t1`.`a`) left join `test`.`t4` on(`test`.`t4`.`b` = `test`.`t3`.`a` and `test`.`t3`.`a` is not null)) on(`test`.`t2`.`a` = `test`.`t1`.`a`) where `test`.`t3`.`a` is null DROP TABLE t1,t2,t3,t4; @@ -1926,11 +1926,11 @@ ON (t1i.K1 = 1) AND OR (t2i.K2 IS NULL)) WHERE t2a.K1r = 1 AND t2i.K2 IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00 -1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index -1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1a NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t2a NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t1i NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t2i NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists Warnings: Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`test`.`t2a`.`K2` AS `K2`,`test`.`t2a`.`K1r` AS `K1r`,`test`.`t2a`.`rowTimestamp` AS `rowTimestamp`,`test`.`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on(`test`.`t2i`.`K1r` = 1)) on(`test`.`t1i`.`K1` = 1 and (`test`.`t2i`.`K1r` = 1 and `test`.`t2i`.`rowTimestamp` > `test`.`t2a`.`rowTimestamp` or `test`.`t2i`.`rowTimestamp` = `test`.`t2a`.`rowTimestamp` and `test`.`t2i`.`K2` > `test`.`t2a`.`K2` or `test`.`t2i`.`K2` is null)) where `test`.`t2a`.`K1r` = 1 and `test`.`t2i`.`K2` is null CREATE VIEW v1 AS @@ -1965,11 +1965,11 @@ OR (t2b.K2 IS NULL) WHERE t1a.K1 = 1 AND t2b.K2 IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00 -1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index -1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1a NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t2a NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t1i NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t2i NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists Warnings: Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`t2a`.`K2` AS `K2`,`t2a`.`K1r` AS `K1r`,`t2a`.`rowTimestamp` AS `rowTimestamp`,`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on(`test`.`t2i`.`K1r` = 1)) on(`test`.`t1i`.`K1` = 1 and (`test`.`t2i`.`K1r` = 1 and `test`.`t2i`.`rowTimestamp` > `t2a`.`rowTimestamp` or `test`.`t2i`.`rowTimestamp` = `t2a`.`rowTimestamp` and `test`.`t2i`.`K2` > `t2a`.`K2` or `test`.`t2i`.`K2` is null)) where `t2a`.`K1r` = 1 and `test`.`t2i`.`K2` is null DROP VIEW v1; @@ -1999,10 +1999,10 @@ pk c1 i1 explain extended SELECT t3.* FROM t3 LEFT JOIN t1 LEFT JOIN t2 ON t1.i1 = t2.i1 ON t3.i1 = t1.i1 WHERE t2.pk < 13 OR t3.i1 IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 18 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 0.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 18 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 0 0.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t3`.`pk` AS `pk`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`i1` AS `i1` from `test`.`t3` left join (`test`.`t1` left join `test`.`t2` on(`test`.`t2`.`i1` = `test`.`t3`.`i1`)) on(`test`.`t1`.`i1` = `test`.`t3`.`i1`) where `test`.`t2`.`pk` < 13 or `test`.`t3`.`i1` is null DROP TABLE t1,t2,t3; @@ -2031,11 +2031,11 @@ ON t7.b=t8.b AND t6.b < 10 ) ON t6.b >= 2 AND t5.b=t7.b AND (t8.a > 0 OR t8.c IS NULL) AND t6.a>0 AND t7.a>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t5 ALL NULL NULL NULL NULL 3 -1 SIMPLE t7 ref|filter PRIMARY,b_i b_i|PRIMARY 5|4 test.t5.b 2 (29%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter -1 SIMPLE t6 range|filter PRIMARY,b_i PRIMARY|b_i 4|5 NULL 3 (86%) Using where; Rowid-ordered scan; Using join buffer (incremental, BNL join); Using rowid filter -1 SIMPLE t8 ref b_i b_i 5 test.t5.b 2 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t7 NULL ref|filter PRIMARY,b_i b_i|PRIMARY 5|4 test.t5.b 2 (29%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter +1 SIMPLE t6 NULL range|filter PRIMARY,b_i PRIMARY|b_i 4|5 NULL 3 (86%) Using where; Rowid-ordered scan; Using join buffer (incremental, BNL join); Using rowid filter +1 SIMPLE t8 NULL ref b_i b_i 5 test.t5.b 2 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM t5 LEFT JOIN @@ -2066,11 +2066,11 @@ SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM t5 LEFT JOIN (t6 LEFT JOIN t7 ON t7.a=1, t8) ON (t5.b=t8.b); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t5 ALL NULL NULL NULL NULL 2 -1 SIMPLE t6 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) -1 SIMPLE t7 const PRIMARY PRIMARY 4 const 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t8 ALL b_i NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL const PRIMARY PRIMARY 4 const 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t8 NULL ALL b_i NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM t5 LEFT JOIN (t6 LEFT JOIN t7 ON t7.a=1, t8) @@ -2083,11 +2083,11 @@ SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM t5 LEFT JOIN (t6 LEFT JOIN t7 ON t7.b=2, t8) ON (t5.b=t8.b); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t5 ALL NULL NULL NULL NULL 2 -1 SIMPLE t6 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) -1 SIMPLE t7 ref b_i b_i 5 const 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t8 ALL b_i NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL ref b_i b_i 5 const 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t8 NULL ALL b_i NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM t5 LEFT JOIN (t6 LEFT JOIN t7 ON t7.b=2, t8) @@ -2100,11 +2100,11 @@ SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM t5 LEFT JOIN (t8, t6 LEFT JOIN t7 ON t7.a=1) ON (t5.b=t8.b); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t5 ALL NULL NULL NULL NULL 2 -1 SIMPLE t8 ALL b_i NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 1 Using join buffer (incremental, BNL join) -1 SIMPLE t7 const PRIMARY PRIMARY 4 const 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t8 NULL ALL b_i NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 1 Using join buffer (incremental, BNL join) +1 SIMPLE t7 NULL const PRIMARY PRIMARY 4 const 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM t5 LEFT JOIN (t8, t6 LEFT JOIN t7 ON t7.a=1) diff --git a/mysql-test/main/join_optimizer.result b/mysql-test/main/join_optimizer.result index ad7267ab665..881c2083b12 100644 --- a/mysql-test/main/join_optimizer.result +++ b/mysql-test/main/join_optimizer.result @@ -31,7 +31,7 @@ For table g this must use ref(groups_dt) and #rows should be around 15 and not 3 explain SELECT STRAIGHT_JOIN g.id FROM t2 a, t3 g USE INDEX(groups_dt) WHERE g.domain = 'queue' AND g.type = a.type; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE a ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE g ref groups_dt groups_dt 70 const,test.a.type 13 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE a NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE g NULL ref groups_dt groups_dt 70 const,test.a.type 13 Using index condition drop table t0,t1,t2,t3; diff --git a/mysql-test/main/join_outer.result b/mysql-test/main/join_outer.result index 522b668e07b..5e7ee8b3359 100644 --- a/mysql-test/main/join_outer.result +++ b/mysql-test/main/join_outer.result @@ -93,12 +93,12 @@ grp a c id a c d 2 3 c NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL explain select t1.*,t2.* from t1,t2 where t1.a=t2.a and isnull(t2.a)=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 8 test.t1.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 8 test.t1.a 1 Using where select t1.*,t2.*,t3.a from t1 left join t2 on (t1.a=t2.a) left join t1 as t3 on (t2.a=t3.a); grp a c id a c d a 1 1 a 1 1 a 1 1 @@ -313,13 +313,13 @@ select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where name name id Lilliana Angelovska NULL NULL explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.id is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where; Not exists explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.name is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where select count(*) from t1 left join t2 on (t1.id = t2.owner); count(*) 4 @@ -333,13 +333,13 @@ select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where name name id Lilliana Angelovska NULL NULL explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.id is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where; Not exists explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.name is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where select count(*) from t2 right join t1 on (t1.id = t2.owner); count(*) 4 @@ -609,9 +609,9 @@ UNIQUE id (id,idx) ); INSERT INTO t2 VALUES (1,1); explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ref id id 4 test.t1.id 1 Using where; Using index; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ref id id 4 test.t1.id 1 Using where; Using index; Not exists SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL; id name id idx 2 no NULL NULL @@ -629,9 +629,9 @@ create table t2 (fooID smallint unsigned not null, barID smallint unsigned not n insert into t1 (fooID) values (10),(20),(30); insert into t2 values (10,1),(20,2),(30,3); explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using index -1 SIMPLE t1 const PRIMARY PRIMARY 2 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 3 Using index +1 SIMPLE t1 NULL const PRIMARY PRIMARY 2 const 1 Using where; Using index select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30; fooID barID fooID 10 1 NULL @@ -687,10 +687,10 @@ a1 a2 b1 b2 c1 c2 2 2 2 3 NULL NULL 3 2 NULL NULL 3 4 explain select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 Using where drop table t1, t2, t3; create table t1 ( a int(11), @@ -737,15 +737,15 @@ insert into t2 values("10", "10"); explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from (t2 s left join t1 m on m.match_id = 1) order by m.match_id desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE s ALL NULL NULL NULL NULL 10 Using temporary; Using filesort -1 SIMPLE m const match_id,match_id_2 match_id 1 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE s NULL ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +1 SIMPLE m NULL const match_id,match_id_2 match_id 1 const 1 explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from (t2 s left join t1 m on m.match_id = 1) order by UUX desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE s ALL NULL NULL NULL NULL 10 Using temporary; Using filesort -1 SIMPLE m const match_id,match_id_2 match_id 1 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE s NULL ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +1 SIMPLE m NULL const match_id,match_id_2 match_id 1 const 1 select s.*, '*', m.*, (s.match_1_h - m.home) UUX from (t2 s left join t1 m on m.match_id = 1) order by UUX desc; @@ -763,9 +763,9 @@ player_id match_1_h * match_id home UUX explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from t2 s straight_join t1 m where m.match_id = 1 order by UUX desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE s ALL NULL NULL NULL NULL 10 Using temporary; Using filesort -1 SIMPLE m const match_id,match_id_2 match_id 1 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE s NULL ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +1 SIMPLE m NULL const match_id,match_id_2 match_id 1 const 1 select s.*, '*', m.*, (s.match_1_h - m.home) UUX from t2 s straight_join t1 m where m.match_id = 1 order by UUX desc; @@ -858,37 +858,37 @@ SELECT * FROM t1 LEFT JOIN t2 ON a1=0; a1 a2 1 NULL EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON a1=0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 LEFT JOIN (t2,t3) ON a1=0; a1 a2 a3 1 NULL NULL EXPLAIN SELECT * FROM t1 LEFT JOIN (t2,t3) ON a1=0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=0 WHERE a0=a1; a0 a1 a2 a3 1 1 NULL NULL EXPLAIN SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=0 WHERE a0=a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 system PRIMARY NULL NULL NULL 1 -1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL system PRIMARY NULL NULL NULL 1 +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 INSERT INTO t0 VALUES (0); INSERT INTO t1 VALUES (0); SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1; a0 a1 a2 a3 1 1 NULL NULL EXPLAIN SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 drop table t1,t2; create table t1 (a int, b int); insert into t1 values (1,1),(2,2),(3,3); @@ -977,10 +977,10 @@ insert t3 values (0, 1, 'a'), (1, 1, 'b'), (0, 2, 'c'), (1, 2, 'd'), (1, 3, 'e') explain select name from t1 left join t2 on t1.x = t2.x and t1.y = t2.y left join t3 on t1.art = t3.id where t2.id =1 and t2.x = -5 and t2.y =-8 and t1.gid =1 and t2.gid =1 and t3.set_id =1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 10 const,const,const 1 -1 SIMPLE t2 const PRIMARY,id PRIMARY 14 const,const,const,const 1 Using index -1 SIMPLE t3 const PRIMARY PRIMARY 3 const,const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 10 const,const,const 1 +1 SIMPLE t2 NULL const PRIMARY,id PRIMARY 14 const,const,const,const 1 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 3 const,const 1 drop tables t1,t2,t3; CREATE TABLE t1 (EMPNUM INT, GRP INT); INSERT INTO t1 VALUES (0, 10); @@ -1130,17 +1130,17 @@ a b a b 6 5 6 4 7 8 7 5 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a = t2.a OR t1.a = t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 4 -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 4 +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a IN(t2.a, t2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 4 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 4 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a > IF(t1.a = t2.b-2, t2.b, t2.b-1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 4 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 4 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 DROP TABLE t1,t2; DROP VIEW IF EXISTS v1,v2; DROP TABLE IF EXISTS t1,t2; @@ -1227,9 +1227,9 @@ INSERT INTO t2 VALUES (3,10), (2,20), (5,30), (3,20), (5,10), (3,40), (3,30), (2,10), (2,40); EXPLAIN SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref idx idx 4 test.t1.id 2 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.id 2 Using where; Not exists flush status; SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL; id a @@ -1252,9 +1252,9 @@ INSERT INTO t1 VALUES (1,0), (2,1); CREATE TABLE t2 (d int PRIMARY KEY); INSERT INTO t2 VALUES (1), (2), (3); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using where; Using index; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 3 Using where; Using index; Not exists SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL; c e d 1 0 NULL @@ -1274,9 +1274,9 @@ EXPLAIN SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b ) FROM t1 LEFT JOIN t2 USING( a ) GROUP BY t1.a WITH ROLLUP; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 Using where SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b ) FROM t1 LEFT JOIN t2 USING( a ) GROUP BY t1.a WITH ROLLUP; @@ -1287,9 +1287,9 @@ EXPLAIN SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b ) FROM t1 JOIN t2 USING( a ) GROUP BY t1.a WITH ROLLUP; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 Using where; Using filesort SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b ) FROM t1 JOIN t2 USING( a ) GROUP BY t1.a WITH ROLLUP; @@ -1306,9 +1306,9 @@ CREATE TABLE t2(f1 INT, f2 INT); INSERT INTO t2 VALUES (2, 1); EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2 WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select 1 AS `f1`,NULL AS `f2`,3 AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t2` where 1 SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2 @@ -1334,16 +1334,16 @@ LEFT OUTER JOIN t1 tt8 ON 1 RIGHT OUTER JOIN t1 tt2 ON 1 RIGHT OUTER JOIN t1 tt1 ON 1 STRAIGHT_JOIN t1 tt9 ON 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tt1 ALL NULL NULL NULL NULL 2 -1 SIMPLE tt2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE tt3 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE tt4 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE tt5 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE tt6 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE tt7 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE tt8 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE tt9 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE tt1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE tt2 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE tt3 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE tt4 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE tt5 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE tt6 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE tt7 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE tt8 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE tt9 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SET optimizer_search_depth = DEFAULT; DROP TABLE t1; # @@ -1360,10 +1360,10 @@ COUNT(*) 476 EXPLAIN SELECT STRAIGHT_JOIN COUNT(*) FROM t1 TA1 RIGHT JOIN t2 TA2 JOIN t2 TA3 ON TA2.f1 ON TA3.f1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE TA2 ALL NULL NULL NULL NULL 20 Using where -1 SIMPLE TA3 ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) -1 SIMPLE TA1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE TA2 NULL ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE TA3 NULL ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +1 SIMPLE TA1 NULL ALL NULL NULL NULL NULL 2 Using where DROP TABLE t1, t2; # # Bug#48971 Segfault in add_found_match_trig_cond () at sql_select.cc:5990 @@ -1378,13 +1378,13 @@ LEFT JOIN t1 AS jt5 ON 1 ON 1 RIGHT JOIN t1 AS jt6 ON jt6.f1 ON 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE jt1 index NULL PRIMARY 4 NULL 2 100.00 Using index -1 SIMPLE jt6 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index -1 SIMPLE jt3 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index -1 SIMPLE jt4 index NULL PRIMARY 4 NULL 2 100.00 Using index -1 SIMPLE jt5 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index -1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE jt1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index +1 SIMPLE jt6 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index +1 SIMPLE jt3 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index +1 SIMPLE jt4 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index +1 SIMPLE jt5 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index +1 SIMPLE jt2 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index Warnings: Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1)) on(1) where 1 EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1 @@ -1395,13 +1395,13 @@ LEFT JOIN t1 AS jt5 ON 1 ON 1 RIGHT JOIN t1 AS jt6 ON jt6.f1 ON 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE jt6 index NULL PRIMARY 4 NULL 2 100.00 Using index -1 SIMPLE jt3 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index -1 SIMPLE jt4 index NULL PRIMARY 4 NULL 2 100.00 Using index -1 SIMPLE jt5 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index -1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index -1 SIMPLE jt1 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE jt6 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index +1 SIMPLE jt3 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index +1 SIMPLE jt4 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index +1 SIMPLE jt5 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index +1 SIMPLE jt2 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index +1 SIMPLE jt1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index Warnings: Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1) left join `test`.`t1` `jt1` on(1) where 1 DROP TABLE t1; @@ -1416,9 +1416,9 @@ INSERT INTO t2 VALUES (7, 7); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 GROUP BY t2.f1, t2.f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 Using temporary; Using filesort -1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 Using temporary; Using filesort +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 Using index SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 GROUP BY t2.f1, t2.f2; @@ -1427,9 +1427,9 @@ f1 f1 f2 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL GROUP BY t2.f1, t2.f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 -1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 Using where; Using index; Using filesort SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL GROUP BY t2.f1, t2.f2; @@ -1450,9 +1450,9 @@ EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.col_int_unique = t2.col_int_unique AND t1.col_int = t2.col_int WHERE t1.pk=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 const col_int_unique col_int_unique 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL const col_int_unique col_int_unique 5 const 1 SELECT * FROM t1 LEFT JOIN t2 ON t1.col_int_unique = t2.col_int_unique AND t1.col_int = t2.col_int WHERE t1.pk=1; @@ -1739,11 +1739,11 @@ where t3.pk=t2.pk+1000 limit 1 ) as t from t1,t2 where t2.pk=t1.pk+1000 and t1.pk>1000 group by t2.pk; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index; Using temporary; Using filesort -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t3.pk 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index; Using temporary; Using filesort +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t4 NULL eq_ref PRIMARY PRIMARY 4 test.t3.pk 1 100.00 Using index Warnings: Note 1276 Field or reference 'test.t2.pk' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`pk` AS `pk`,<expr_cache><`test`.`t2`.`pk`>((/* select#2 */ select `test`.`t3`.`pk` + if(`test`.`t4`.`pk` is null,0,`test`.`t4`.`pk`) from `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`pk` = `test`.`t3`.`pk`) where `test`.`t3`.`pk` = `test`.`t2`.`pk` + 1000 limit 1)) AS `t` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`pk` = `test`.`t1`.`pk` + 1000 and `test`.`t1`.`pk` > 1000 group by `test`.`t2`.`pk` @@ -1838,9 +1838,9 @@ INSERT INTO t2 VALUES (7, 7); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 GROUP BY t2.f1, t2.f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 Using temporary; Using filesort -1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 Using temporary; Using filesort +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 Using index SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 GROUP BY t2.f1, t2.f2; @@ -1849,9 +1849,9 @@ f1 f1 f2 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL GROUP BY t2.f1, t2.f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 -1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 Using where; Using index; Using filesort SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL GROUP BY t2.f1, t2.f2; @@ -1929,10 +1929,10 @@ a NULL EXPLAIN EXTENDED SELECT t2.a FROM t1 LEFT JOIN t2 ON (6) IN (SELECT a FROM t3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 /* select#1 */ select NULL AS `a` from `test`.`t2` where 1 DROP TABLE t1,t2,t3; @@ -1949,20 +1949,20 @@ insert into t3 values ('c','d'); insert into t3 values ('c','d'); EXPLAIN SELECT t2.b FROM t1 LEFT JOIN t2 ON t1.c = t2.a AND ( t2.b , t1.b ) IN (SELECT * from t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 const 1 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 const 1 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t2.b FROM t1 LEFT JOIN t2 ON t1.c = t2.a AND ( t2.b , t1.b ) IN (SELECT * from t3); b NULL EXPLAIN SELECT t2.b FROM t1 LEFT JOIN t2 ON (t2.b) IN (SELECT c2 from t3) AND t2.a = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 const PRIMARY PRIMARY 4 const 1 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL const PRIMARY PRIMARY 4 const 1 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t2.b FROM t1 LEFT JOIN t2 ON (t2.b) IN (SELECT c2 from t3) AND t2.a = 1; b @@ -2007,10 +2007,10 @@ set @save_join_cache_level= @@join_cache_level; SET SESSION join_cache_level=4; EXPLAIN EXTENDED SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t3 hash_ALL PRIMARY #hash#PRIMARY 4 test.t1.b 10 10.00 Using join buffer (flat, BNLH join) -1 SIMPLE t2 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t1.b 27 3.70 Using index; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t3 NULL hash_ALL PRIMARY #hash#PRIMARY 4 test.t1.b 10 10.00 Using join buffer (flat, BNLH join) +1 SIMPLE t2 NULL hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t1.b 27 3.70 Using index; Using join buffer (incremental, BNLH join) Warnings: Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t2` join `test`.`t1` join `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`b` and `test`.`t2`.`b` = `test`.`t1`.`b` PREPARE stmt FROM @@ -2041,9 +2041,9 @@ EXPLAIN EXTENDED SELECT t1.pk FROM t2 JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00 -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index Warnings: Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where 1 order by 5 SELECT t1.pk FROM t2 JOIN t1 ON t2.pk = t1.a @@ -2055,9 +2055,9 @@ EXPLAIN EXTENDED SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 const PRIMARY,idx PRIMARY 4 const 1 100.00 -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY,idx PRIMARY 4 const 1 100.00 +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index Warnings: Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where 1 order by 5 SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a @@ -2077,9 +2077,9 @@ EXPLAIN EXTENDED SELECT t1.b, t2.c, t2.d FROM t2 JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref idx idx 4 const 2 100.00 Using where -1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx idx 4 const 2 100.00 Using where +1 SIMPLE t2 NULL ref c c 5 test.t1.a 2 100.00 Warnings: Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 JOIN t1 ON t2.c = t1.a @@ -2094,9 +2094,9 @@ EXPLAIN EXTENDED SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where -1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref PRIMARY,idx idx 4 const 2 100.00 Using where +1 SIMPLE t2 NULL ref c c 5 test.t1.a 2 100.00 Warnings: Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a @@ -2131,17 +2131,17 @@ alter table t0 add person_id varchar(255) not null; create table t1 (pk int not null primary key); insert into t1 select A.a + 10*B.a from t0 A, t0 B; explain select * from t1 left join t0 on t0.a=t1.pk where t0.person_id='fooo' or 'xyz' IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using index explain select * from t1 left join t0 on t0.a=t1.pk where t0.person_id='fooo'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using index explain select * from t1 left join t0 on t0.a=t1.pk where t0.person_id='fooo' or t0.person_id='bar'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using index drop table t0, t1; # # MDEV-4836: Wrong result on <not null date column> IS NULL (old documented hack stopped working) @@ -2220,10 +2220,10 @@ i1 i2 i3 d3 EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON i2 = i3 ON i1 = i3 WHERE d3 IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`i2` = `test`.`t1`.`i1` and `test`.`t3`.`i3` = `test`.`t1`.`i1`) where `test`.`t3`.`d3` = 0 or `test`.`t3`.`d3` is null DROP TABLE t1,t2,t3; @@ -2240,10 +2240,10 @@ INSERT INTO t3 VALUES (3),(8); EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a WHERE b IN (1,2,3) OR b = d; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`d` = 10) where `test`.`t2`.`c` = 8 and `test`.`t3`.`d` = 8 SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a @@ -2264,19 +2264,19 @@ from t1 A, t1 B, t1 C; delete from t1 where a=0; # Check that there are different #rows of NULLs for b and c, both !=10: explain select * from t2 force index (b) where b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref b b 5 const 780 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref b b 5 const 780 Using index condition explain select * from t2 force index (c) where c is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref c c 5 const 393 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref c c 5 const 393 Using index condition explain select * from t1 left join t2 on t2.b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 9 -1 SIMPLE t2 ALL b NULL NULL NULL 1000 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 9 +1 SIMPLE t2 NULL ALL b NULL NULL NULL 1000 Using where explain select * from t1 left join t2 on t2.c is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 9 -1 SIMPLE t2 ALL c NULL NULL NULL 1000 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 9 +1 SIMPLE t2 NULL ALL c NULL NULL NULL 1000 Using where drop table t1,t2; # # MDEV-10006: optimizer doesn't convert outer join to inner on views with WHERE clause @@ -2316,10 +2316,10 @@ FROM t1 JOIN t2 on t1.i1 = t2.i2 LEFT JOIN t3 on t2.i2 = t3.i3 ) as w1 WHERE v3 = 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ref PRIMARY,v3 v3 5 const 1 100.00 -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ref PRIMARY,v3 v3 5 const 1 100.00 +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3` # This should have the same join order like the query above: @@ -2334,10 +2334,10 @@ WHERE t1.i1 = t2.i2 AND 1 = 1 ) as w2 WHERE v3 = 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ref PRIMARY,v3 v3 5 const 1 100.00 -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ref PRIMARY,v3 v3 5 const 1 100.00 +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3` drop table t1,t2,t3; @@ -2358,9 +2358,9 @@ SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0) FROM t t1 LEFT JOIN t t2 ON t1.x = t2.x WHERE IFNULL(t2.x,0)=0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x`) where ifnull(`test`.`t2`.`x`,0) = 0 SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0) @@ -2374,9 +2374,9 @@ SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0) FROM t t1 LEFT JOIN t t2 ON t1.x = t2.x WHERE f(t2.x,0)=0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x`) where `f`(`test`.`t2`.`x`,0) = 0 drop function f; @@ -2414,9 +2414,9 @@ col1 col1 col3 EXPLAIN EXTENDED SELECT t1.col1, t2.col1, t2.col3 FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2 WHERE IFNULL(t2.col3,0) = 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where ifnull(`test`.`t2`.`col3`,0) = 0 SELECT t1.col1, t2.col1, t2.col3 @@ -2428,9 +2428,9 @@ col1 col1 col3 EXPLAIN EXTENDED SELECT t1.col1, t2.col1, t2.col3 FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2 WHERE f1(t2.col3,0) = 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where `f1`(`test`.`t2`.`col3`,0) = 0 DROP FUNCTION f1; @@ -2487,8 +2487,8 @@ RIGHT JOIN ON t1.pk = t2.pk AND t2.v2 = tb1.v1 WHERE tb1.pk = 40 ORDER BY tb1.i1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select straight_join 'p' AS `v2` from `test`.`t1` join `test`.`t1` `tb1` left join `test`.`t1` `tb2` on(multiple equal(NULL, NULL)) where 0 order by NULL EXPLAIN EXTENDED @@ -2500,8 +2500,8 @@ LEFT JOIN ON t1.pk = t2.pk AND t2.v2 = tb1.v1 WHERE tb1.pk = 40 ORDER BY tb1.i1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select straight_join 'p' AS `v2` from `test`.`t1` join `test`.`t1` `tb1` left join `test`.`t1` `tb2` on(multiple equal(NULL, NULL)) where 0 order by NULL SELECT STRAIGHT_JOIN DISTINCT t2.v2 @@ -2532,9 +2532,9 @@ a b 3 3 1 NULL explain extended select * from t1 left join t2 on a=b where (b > 3) is not true; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a`) where `test`.`t2`.`b` > 3 is not true select * from t1 left join t2 on a=b where (b > 3) is not false; @@ -2542,9 +2542,9 @@ a b 7 7 1 NULL explain extended select * from t1 left join t2 on a=b where (b > 3) is not false; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a`) where `test`.`t2`.`b` > 3 is not false drop table t1,t2; @@ -2642,11 +2642,11 @@ INNER JOIN t3 ON t3.id=t2.profile_id INNER JOIN t4 ON t4.id=t3.person_id WHERE t1.timestamp < 1294664900039 AND t1.timestamp > 1294644616416 AND t2.REVTYPE=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 42 100.00 Using where -1 SIMPLE t3 ref PRIMARY PRIMARY 4 test.t2.profile_id 1 100.00 Using where -1 SIMPLE t4 ref PRIMARY PRIMARY 4 test.t3.person_id 1 100.00 Using index -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.REV 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 42 100.00 Using where +1 SIMPLE t3 NULL ref PRIMARY PRIMARY 4 test.t2.profile_id 1 100.00 Using where +1 SIMPLE t4 NULL ref PRIMARY PRIMARY 4 test.t3.person_id 1 100.00 Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.REV 1 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`timestamp` AS `timestamp`,`test`.`t1`.`modifiedBy` AS `modifiedBy`,`test`.`t2`.`id` AS `id`,`test`.`t2`.`REV` AS `REV`,`test`.`t2`.`REVTYPE` AS `REVTYPE`,`test`.`t2`.`profile_id` AS `profile_id`,`test`.`t3`.`id` AS `id`,`test`.`t3`.`REV` AS `REV`,`test`.`t3`.`person_id` AS `person_id`,`test`.`t4`.`id` AS `id`,`test`.`t4`.`REV` AS `REV` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` where `test`.`t2`.`REVTYPE` = 2 and `test`.`t4`.`id` = `test`.`t3`.`person_id` and `test`.`t3`.`id` = `test`.`t2`.`profile_id` and `test`.`t1`.`id` = `test`.`t2`.`REV` and `test`.`t1`.`timestamp` < 1294664900039 and `test`.`t1`.`timestamp` > 1294644616416 SELECT * @@ -2667,11 +2667,11 @@ RIGHT JOIN t3 ON t3.id=t2.profile_id RIGHT JOIN t4 ON t4.id=t3.person_id WHERE t1.timestamp < 1294664900039 AND t1.timestamp > 1294644616416 AND t2.REVTYPE=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 42 100.00 Using where -1 SIMPLE t3 ref PRIMARY PRIMARY 4 test.t2.profile_id 1 100.00 Using where -1 SIMPLE t4 ref PRIMARY PRIMARY 4 test.t3.person_id 1 100.00 Using index -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.REV 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 42 100.00 Using where +1 SIMPLE t3 NULL ref PRIMARY PRIMARY 4 test.t2.profile_id 1 100.00 Using where +1 SIMPLE t4 NULL ref PRIMARY PRIMARY 4 test.t3.person_id 1 100.00 Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.REV 1 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`timestamp` AS `timestamp`,`test`.`t1`.`modifiedBy` AS `modifiedBy`,`test`.`t2`.`id` AS `id`,`test`.`t2`.`REV` AS `REV`,`test`.`t2`.`REVTYPE` AS `REVTYPE`,`test`.`t2`.`profile_id` AS `profile_id`,`test`.`t3`.`id` AS `id`,`test`.`t3`.`REV` AS `REV`,`test`.`t3`.`person_id` AS `person_id`,`test`.`t4`.`id` AS `id`,`test`.`t4`.`REV` AS `REV` from `test`.`t4` join `test`.`t3` join `test`.`t2` join `test`.`t1` where `test`.`t2`.`REVTYPE` = 2 and `test`.`t1`.`id` = `test`.`t2`.`REV` and `test`.`t3`.`id` = `test`.`t2`.`profile_id` and `test`.`t4`.`id` = `test`.`t3`.`person_id` and `test`.`t1`.`timestamp` < 1294664900039 and `test`.`t1`.`timestamp` > 1294644616416 SELECT * @@ -2768,15 +2768,15 @@ create table t3 (a int, b int, key(a)); insert into t3 select A.a + B.a* 10 + C.a * 100, 12345 from t1 A, t1 B, t1 C; # Uses range for table t3: explain select * from t1 left join t3 on t1.a=t3.b and t3.a<5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 -1 SIMPLE t3 range a a 5 NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t3 NULL range a a 5 NULL 5 Using where # This must use range for table t3, too: explain select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t3 range a a 5 NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t3 NULL range a a 5 NULL 5 Using where # # .. part 2: make sure condition selectivity can use the condition too. # @@ -2793,17 +2793,17 @@ test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK # t3.filtered is less than 100%: explain extended select * from t1 left join t3 on t1.a=t3.b and t3.a<5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 1000 0.50 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1000 0.50 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`a` < 5) where 1 # t3.filtered must less than 100%, too: explain extended select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 1000 0.50 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1000 0.50 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t3` join `test`.`t2`) on(`test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`a` < 5) where 1 drop table t1,t2,t3; diff --git a/mysql-test/main/join_outer_innodb.result b/mysql-test/main/join_outer_innodb.result index 6f87048cdc1..8faaec2f3db 100644 --- a/mysql-test/main/join_outer_innodb.result +++ b/mysql-test/main/join_outer_innodb.result @@ -9,15 +9,15 @@ INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3); EXPLAIN SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id WHERE t1.name LIKE 'A%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,name name 23 NULL 2 Using where; Using index -1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,name name 23 NULL 2 Using where; Using index +1 SIMPLE t2 NULL ref fkey fkey 5 test.t1.id 1 Using index EXPLAIN SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id WHERE t1.name LIKE 'A%' OR FALSE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,name name 23 NULL 2 Using where; Using index -1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,name name 23 NULL 2 Using where; Using index +1 SIMPLE t2 NULL ref fkey fkey 5 test.t1.id 1 Using index DROP TABLE t1,t2; # # BUG#58456: Assertion 0 in QUICK_INDEX_MERGE_SELECT::need_sorted_output @@ -41,8 +41,8 @@ FROM t2 LEFT JOIN t1 ON t2.pk = t1.col_int WHERE t1.col_int_key BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk IN (5) ORDER BY pk; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.col_int @@ -133,14 +133,14 @@ AND t5.col_varchar_10_utf8_key = 0 ) ON t6a.pk IS TRUE WHERE t6b.col_int_key IS TRUE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t6a ALL NULL NULL NULL NULL 1 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using join buffer (incremental, BNL join) -1 SIMPLE t5 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t6b ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t6a NULL ALL NULL NULL NULL NULL 1 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 Using join buffer (incremental, BNL join) +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t6b NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) SELECT t6a.pk, t2.pk FROM t6 AS t6a LEFT JOIN @@ -179,14 +179,14 @@ AND t5.col_varchar_10_utf8_key = 0 ) ON t6a.pk IS TRUE WHERE t6b.col_int_key IS TRUE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t6a ALL NULL NULL NULL NULL 1 Using where -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) -1 SIMPLE t4 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using join buffer (incremental, BNL join) -1 SIMPLE t5 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t6b ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t6a NULL ALL NULL NULL NULL NULL 1 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 Using join buffer (incremental, BNL join) +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t6b NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) drop table t1,t2,t3,t4,t5,t6; # Bug mdev-4318: view over a complex query with outer joins @@ -433,49 +433,49 @@ left join t15 on t1.a9 = t15.o1 ) left join t16 on t15.o1 = t16.p1 where t1.a10 = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a4,a6,a5,a7 NULL NULL NULL 3 Using where -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where; Using index -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.d1 1 Using where -1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index -1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1 -1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1 -1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t1.a5 1 -1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where -1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where -1 SIMPLE t13 ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index -1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index -1 SIMPLE m2 ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index -1 SIMPLE l3 eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where -1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where -1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index -1 SIMPLE t16 ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where -1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a4,a6,a5,a7 NULL NULL NULL 3 Using where +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where; Using index +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.d1 1 Using where +1 SIMPLE t6 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index +1 SIMPLE t8 NULL eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 1 test.t1.a7 1 +1 SIMPLE t9 NULL ref PRIMARY PRIMARY 1 test.t1.a4 1 +1 SIMPLE t11 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a5 1 +1 SIMPLE t12 NULL eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where +1 SIMPLE l2 NULL eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where +1 SIMPLE t13 NULL ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index +1 SIMPLE l4 NULL eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index +1 SIMPLE m2 NULL ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index +1 SIMPLE l3 NULL eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where +1 SIMPLE t14 NULL eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where +1 SIMPLE t15 NULL eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index +1 SIMPLE t16 NULL ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where +1 SIMPLE t10 NULL ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) explain select * from v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a4,a6,a5,a7 NULL NULL NULL 3 Using where -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where; Using index -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.d1 1 Using where -1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index -1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1 -1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1 -1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t1.a5 1 -1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where -1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where -1 SIMPLE t13 ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index -1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index -1 SIMPLE m2 ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index -1 SIMPLE l3 eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where -1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where -1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index -1 SIMPLE t16 ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where -1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a4,a6,a5,a7 NULL NULL NULL 3 Using where +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where; Using index +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.d1 1 Using where +1 SIMPLE t6 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index +1 SIMPLE t8 NULL eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 1 test.t1.a7 1 +1 SIMPLE t9 NULL ref PRIMARY PRIMARY 1 test.t1.a4 1 +1 SIMPLE t11 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a5 1 +1 SIMPLE t12 NULL eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where +1 SIMPLE l2 NULL eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where +1 SIMPLE t13 NULL ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index +1 SIMPLE l4 NULL eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index +1 SIMPLE m2 NULL ref PRIMARY,m3 m3 8 const,test.t1.a1 1 Using index +1 SIMPLE l3 NULL eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where +1 SIMPLE t14 NULL eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where +1 SIMPLE t15 NULL eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index +1 SIMPLE t16 NULL ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where +1 SIMPLE t10 NULL ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) drop view v1; drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16; # diff --git a/mysql-test/main/join_outer_jcl6.result b/mysql-test/main/join_outer_jcl6.result index b579cfc6ac0..6e88bb8932a 100644 --- a/mysql-test/main/join_outer_jcl6.result +++ b/mysql-test/main/join_outer_jcl6.result @@ -100,12 +100,12 @@ grp a c id a c d 2 3 c NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL explain select t1.*,t2.* from t1,t2 where t1.a=t2.a and isnull(t2.a)=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 8 test.t1.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 8 test.t1.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan select t1.*,t2.*,t3.a from t1 left join t2 on (t1.a=t2.a) left join t1 as t3 on (t2.a=t3.a); grp a c id a c d a 1 1 a 1 1 a 1 1 @@ -320,13 +320,13 @@ select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where name name id Lilliana Angelovska NULL NULL explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.id is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 2 test.t1.id 3 Using where; Not exists; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 2 test.t1.id 3 Using where; Not exists; Using join buffer (flat, BNLH join) explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.name is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 2 test.t1.id 3 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 2 test.t1.id 3 Using where; Using join buffer (flat, BNLH join) select count(*) from t1 left join t2 on (t1.id = t2.owner); count(*) 4 @@ -340,13 +340,13 @@ select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where name name id Lilliana Angelovska NULL NULL explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.id is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 2 test.t1.id 3 Using where; Not exists; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 2 test.t1.id 3 Using where; Not exists; Using join buffer (flat, BNLH join) explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.name is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 2 test.t1.id 3 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 2 test.t1.id 3 Using where; Using join buffer (flat, BNLH join) select count(*) from t2 right join t1 on (t1.id = t2.owner); count(*) 4 @@ -616,9 +616,9 @@ UNIQUE id (id,idx) ); INSERT INTO t2 VALUES (1,1); explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ref id id 4 test.t1.id 1 Using where; Using index; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ref id id 4 test.t1.id 1 Using where; Using index; Not exists SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL; id name id idx 2 no NULL NULL @@ -636,9 +636,9 @@ create table t2 (fooID smallint unsigned not null, barID smallint unsigned not n insert into t1 (fooID) values (10),(20),(30); insert into t2 values (10,1),(20,2),(30,3); explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using index -1 SIMPLE t1 const PRIMARY PRIMARY 2 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 3 Using index +1 SIMPLE t1 NULL const PRIMARY PRIMARY 2 const 1 Using where; Using index select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30; fooID barID fooID 10 1 NULL @@ -694,10 +694,10 @@ a1 a2 b1 b2 c1 c2 1 2 1 3 NULL NULL 2 2 2 3 NULL NULL explain select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 4 test.t1.a1 2 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.a1 2 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 4 test.t1.a1 2 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t3 NULL hash_ALL NULL #hash#$hj 5 test.t1.a1 2 Using where; Using join buffer (incremental, BNLH join) drop table t1, t2, t3; create table t1 ( a int(11), @@ -744,15 +744,15 @@ insert into t2 values("10", "10"); explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from (t2 s left join t1 m on m.match_id = 1) order by m.match_id desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE s ALL NULL NULL NULL NULL 10 Using temporary; Using filesort -1 SIMPLE m const match_id,match_id_2 match_id 1 const 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE s NULL ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +1 SIMPLE m NULL const match_id,match_id_2 match_id 1 const 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from (t2 s left join t1 m on m.match_id = 1) order by UUX desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE s ALL NULL NULL NULL NULL 10 Using temporary; Using filesort -1 SIMPLE m const match_id,match_id_2 match_id 1 const 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE s NULL ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +1 SIMPLE m NULL const match_id,match_id_2 match_id 1 const 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan select s.*, '*', m.*, (s.match_1_h - m.home) UUX from (t2 s left join t1 m on m.match_id = 1) order by UUX desc; @@ -770,9 +770,9 @@ player_id match_1_h * match_id home UUX explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from t2 s straight_join t1 m where m.match_id = 1 order by UUX desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE s ALL NULL NULL NULL NULL 10 Using temporary; Using filesort -1 SIMPLE m const match_id,match_id_2 match_id 1 const 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE s NULL ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +1 SIMPLE m NULL const match_id,match_id_2 match_id 1 const 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan select s.*, '*', m.*, (s.match_1_h - m.home) UUX from t2 s straight_join t1 m where m.match_id = 1 order by UUX desc; @@ -865,37 +865,37 @@ SELECT * FROM t1 LEFT JOIN t2 ON a1=0; a1 a2 1 NULL EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON a1=0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 LEFT JOIN (t2,t3) ON a1=0; a1 a2 a3 1 NULL NULL EXPLAIN SELECT * FROM t1 LEFT JOIN (t2,t3) ON a1=0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=0 WHERE a0=a1; a0 a1 a2 a3 1 1 NULL NULL EXPLAIN SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=0 WHERE a0=a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 system PRIMARY NULL NULL NULL 1 -1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL system PRIMARY NULL NULL NULL 1 +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 INSERT INTO t0 VALUES (0); INSERT INTO t1 VALUES (0); SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1; a0 a1 a2 a3 1 1 NULL NULL EXPLAIN SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 drop table t1,t2; create table t1 (a int, b int); insert into t1 values (1,1),(2,2),(3,3); @@ -984,10 +984,10 @@ insert t3 values (0, 1, 'a'), (1, 1, 'b'), (0, 2, 'c'), (1, 2, 'd'), (1, 3, 'e') explain select name from t1 left join t2 on t1.x = t2.x and t1.y = t2.y left join t3 on t1.art = t3.id where t2.id =1 and t2.x = -5 and t2.y =-8 and t1.gid =1 and t2.gid =1 and t3.set_id =1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 10 const,const,const 1 -1 SIMPLE t2 const PRIMARY,id PRIMARY 14 const,const,const,const 1 Using index -1 SIMPLE t3 const PRIMARY PRIMARY 3 const,const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 10 const,const,const 1 +1 SIMPLE t2 NULL const PRIMARY,id PRIMARY 14 const,const,const,const 1 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 3 const,const 1 drop tables t1,t2,t3; CREATE TABLE t1 (EMPNUM INT, GRP INT); INSERT INTO t1 VALUES (0, 10); @@ -1137,17 +1137,17 @@ a b a b 6 5 6 4 7 8 7 5 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a = t2.a OR t1.a = t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 4 -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 4 +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a IN(t2.a, t2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 4 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 4 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a > IF(t1.a = t2.b-2, t2.b, t2.b-1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 4 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 4 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan DROP TABLE t1,t2; DROP VIEW IF EXISTS v1,v2; DROP TABLE IF EXISTS t1,t2; @@ -1234,9 +1234,9 @@ INSERT INTO t2 VALUES (3,10), (2,20), (5,30), (3,20), (5,10), (3,40), (3,30), (2,10), (2,40); EXPLAIN SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref idx idx 4 test.t1.id 2 Using where; Not exists; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.id 2 Using where; Not exists; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan flush status; SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL; id a @@ -1259,9 +1259,9 @@ INSERT INTO t1 VALUES (1,0), (2,1); CREATE TABLE t2 (d int PRIMARY KEY); INSERT INTO t2 VALUES (1), (2), (3); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using where; Using index; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 3 Using where; Using index; Not exists SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL; c e d 1 0 NULL @@ -1281,9 +1281,9 @@ EXPLAIN SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b ) FROM t1 LEFT JOIN t2 USING( a ) GROUP BY t1.a WITH ROLLUP; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 Using where SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b ) FROM t1 LEFT JOIN t2 USING( a ) GROUP BY t1.a WITH ROLLUP; @@ -1294,9 +1294,9 @@ EXPLAIN SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b ) FROM t1 JOIN t2 USING( a ) GROUP BY t1.a WITH ROLLUP; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 Using where; Using filesort SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b ) FROM t1 JOIN t2 USING( a ) GROUP BY t1.a WITH ROLLUP; @@ -1313,9 +1313,9 @@ CREATE TABLE t2(f1 INT, f2 INT); INSERT INTO t2 VALUES (2, 1); EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2 WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select 1 AS `f1`,NULL AS `f2`,3 AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t2` where 1 SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2 @@ -1341,16 +1341,16 @@ LEFT OUTER JOIN t1 tt8 ON 1 RIGHT OUTER JOIN t1 tt2 ON 1 RIGHT OUTER JOIN t1 tt1 ON 1 STRAIGHT_JOIN t1 tt9 ON 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tt1 ALL NULL NULL NULL NULL 2 -1 SIMPLE tt2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -1 SIMPLE tt3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE tt4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE tt5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE tt6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE tt7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE tt8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE tt9 ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE tt1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE tt2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 SIMPLE tt3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE tt4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE tt5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE tt6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE tt7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE tt8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE tt9 NULL ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join) SET optimizer_search_depth = DEFAULT; DROP TABLE t1; # @@ -1367,10 +1367,10 @@ COUNT(*) 476 EXPLAIN SELECT STRAIGHT_JOIN COUNT(*) FROM t1 TA1 RIGHT JOIN t2 TA2 JOIN t2 TA3 ON TA2.f1 ON TA3.f1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE TA2 ALL NULL NULL NULL NULL 20 Using where -1 SIMPLE TA3 ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) -1 SIMPLE TA1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE TA2 NULL ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE TA3 NULL ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +1 SIMPLE TA1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) DROP TABLE t1, t2; # # Bug#48971 Segfault in add_found_match_trig_cond () at sql_select.cc:5990 @@ -1385,13 +1385,13 @@ LEFT JOIN t1 AS jt5 ON 1 ON 1 RIGHT JOIN t1 AS jt6 ON jt6.f1 ON 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE jt1 index NULL PRIMARY 4 NULL 2 100.00 Using index -1 SIMPLE jt6 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (flat, BNL join) -1 SIMPLE jt3 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) -1 SIMPLE jt4 index NULL PRIMARY 4 NULL 2 100.00 Using index; Using join buffer (incremental, BNL join) -1 SIMPLE jt5 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) -1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE jt1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index +1 SIMPLE jt6 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (flat, BNL join) +1 SIMPLE jt3 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) +1 SIMPLE jt4 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index; Using join buffer (incremental, BNL join) +1 SIMPLE jt5 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) +1 SIMPLE jt2 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) Warnings: Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt1` left join (`test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1)) on(1) where 1 EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1 @@ -1402,13 +1402,13 @@ LEFT JOIN t1 AS jt5 ON 1 ON 1 RIGHT JOIN t1 AS jt6 ON jt6.f1 ON 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE jt6 index NULL PRIMARY 4 NULL 2 100.00 Using index -1 SIMPLE jt3 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (flat, BNL join) -1 SIMPLE jt4 index NULL PRIMARY 4 NULL 2 100.00 Using index; Using join buffer (incremental, BNL join) -1 SIMPLE jt5 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) -1 SIMPLE jt2 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) -1 SIMPLE jt1 index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE jt6 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index +1 SIMPLE jt3 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (flat, BNL join) +1 SIMPLE jt4 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index; Using join buffer (incremental, BNL join) +1 SIMPLE jt5 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) +1 SIMPLE jt2 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) +1 SIMPLE jt1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index; Using join buffer (incremental, BNL join) Warnings: Note 1003 select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on(`test`.`jt6`.`f1` <> 0 and 1) left join `test`.`t1` `jt1` on(1) where 1 DROP TABLE t1; @@ -1423,9 +1423,9 @@ INSERT INTO t2 VALUES (7, 7); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 GROUP BY t2.f1, t2.f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 Using temporary; Using filesort -1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 Using temporary; Using filesort +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 Using index SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 GROUP BY t2.f1, t2.f2; @@ -1434,9 +1434,9 @@ f1 f1 f2 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL GROUP BY t2.f1, t2.f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 -1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 Using where; Using index; Using filesort SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL GROUP BY t2.f1, t2.f2; @@ -1457,9 +1457,9 @@ EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.col_int_unique = t2.col_int_unique AND t1.col_int = t2.col_int WHERE t1.pk=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 const col_int_unique col_int_unique 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL const col_int_unique col_int_unique 5 const 1 SELECT * FROM t1 LEFT JOIN t2 ON t1.col_int_unique = t2.col_int_unique AND t1.col_int = t2.col_int WHERE t1.pk=1; @@ -1746,11 +1746,11 @@ where t3.pk=t2.pk+1000 limit 1 ) as t from t1,t2 where t2.pk=t1.pk+1000 and t1.pk>1000 group by t2.pk; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index; Using temporary; Using filesort -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t3.pk 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index; Using temporary; Using filesort +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t4 NULL eq_ref PRIMARY PRIMARY 4 test.t3.pk 1 100.00 Using index Warnings: Note 1276 Field or reference 'test.t2.pk' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`pk` AS `pk`,<expr_cache><`test`.`t2`.`pk`>((/* select#2 */ select `test`.`t3`.`pk` + if(`test`.`t4`.`pk` is null,0,`test`.`t4`.`pk`) from `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`pk` = `test`.`t3`.`pk`) where `test`.`t3`.`pk` = `test`.`t2`.`pk` + 1000 limit 1)) AS `t` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`pk` = `test`.`t1`.`pk` + 1000 and `test`.`t1`.`pk` > 1000 group by `test`.`t2`.`pk` @@ -1845,9 +1845,9 @@ INSERT INTO t2 VALUES (7, 7); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 GROUP BY t2.f1, t2.f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 Using temporary; Using filesort -1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 Using temporary; Using filesort +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 Using index SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 GROUP BY t2.f1, t2.f2; @@ -1856,9 +1856,9 @@ f1 f1 f2 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL GROUP BY t2.f1, t2.f2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 -1 SIMPLE t2 ref PRIMARY PRIMARY 4 const 1 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 Using where; Using index; Using filesort SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1 WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL GROUP BY t2.f1, t2.f2; @@ -1936,10 +1936,10 @@ a NULL EXPLAIN EXTENDED SELECT t2.a FROM t1 LEFT JOIN t2 ON (6) IN (SELECT a FROM t3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 /* select#1 */ select NULL AS `a` from `test`.`t2` where 1 DROP TABLE t1,t2,t3; @@ -1956,20 +1956,20 @@ insert into t3 values ('c','d'); insert into t3 values ('c','d'); EXPLAIN SELECT t2.b FROM t1 LEFT JOIN t2 ON t1.c = t2.a AND ( t2.b , t1.b ) IN (SELECT * from t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 const 1 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 const 1 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t2.b FROM t1 LEFT JOIN t2 ON t1.c = t2.a AND ( t2.b , t1.b ) IN (SELECT * from t3); b NULL EXPLAIN SELECT t2.b FROM t1 LEFT JOIN t2 ON (t2.b) IN (SELECT c2 from t3) AND t2.a = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 const PRIMARY PRIMARY 4 const 1 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL const PRIMARY PRIMARY 4 const 1 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t2.b FROM t1 LEFT JOIN t2 ON (t2.b) IN (SELECT c2 from t3) AND t2.a = 1; b @@ -2014,10 +2014,10 @@ set @save_join_cache_level= @@join_cache_level; SET SESSION join_cache_level=4; EXPLAIN EXTENDED SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t3 hash_ALL PRIMARY #hash#PRIMARY 4 test.t1.b 10 10.00 Using join buffer (flat, BNLH join) -1 SIMPLE t2 hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t1.b 27 3.70 Using index; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t3 NULL hash_ALL PRIMARY #hash#PRIMARY 4 test.t1.b 10 10.00 Using join buffer (flat, BNLH join) +1 SIMPLE t2 NULL hash_index PRIMARY #hash#PRIMARY:PRIMARY 4:4 test.t1.b 27 3.70 Using index; Using join buffer (incremental, BNLH join) Warnings: Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t2` join `test`.`t1` join `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`b` and `test`.`t2`.`b` = `test`.`t1`.`b` PREPARE stmt FROM @@ -2048,9 +2048,9 @@ EXPLAIN EXTENDED SELECT t1.pk FROM t2 JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00 -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index Warnings: Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where 1 order by 5 SELECT t1.pk FROM t2 JOIN t1 ON t2.pk = t1.a @@ -2062,9 +2062,9 @@ EXPLAIN EXTENDED SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5 ORDER BY t1.pk; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 const PRIMARY,idx PRIMARY 4 const 1 100.00 -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY,idx PRIMARY 4 const 1 100.00 +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index Warnings: Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where 1 order by 5 SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a @@ -2084,9 +2084,9 @@ EXPLAIN EXTENDED SELECT t1.b, t2.c, t2.d FROM t2 JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref idx idx 4 const 2 100.00 Using where -1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx idx 4 const 2 100.00 Using where +1 SIMPLE t2 NULL ref c c 5 test.t1.a 2 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 JOIN t1 ON t2.c = t1.a @@ -2101,9 +2101,9 @@ EXPLAIN EXTENDED SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where -1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref PRIMARY,idx idx 4 const 2 100.00 Using where +1 SIMPLE t2 NULL ref c c 5 test.t1.a 2 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a @@ -2138,17 +2138,17 @@ alter table t0 add person_id varchar(255) not null; create table t1 (pk int not null primary key); insert into t1 select A.a + 10*B.a from t0 A, t0 B; explain select * from t1 left join t0 on t0.a=t1.pk where t0.person_id='fooo' or 'xyz' IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using index explain select * from t1 left join t0 on t0.a=t1.pk where t0.person_id='fooo'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using index explain select * from t1 left join t0 on t0.a=t1.pk where t0.person_id='fooo' or t0.person_id='bar'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using index drop table t0, t1; # # MDEV-4836: Wrong result on <not null date column> IS NULL (old documented hack stopped working) @@ -2227,10 +2227,10 @@ i1 i2 i3 d3 EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON i2 = i3 ON i1 = i3 WHERE d3 IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.i1 2 100.00 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.i1 2 100.00 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 5 test.t1.i1 2 100.00 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t3 NULL hash_ALL NULL #hash#$hj 5 test.t1.i1 2 100.00 Using where; Using join buffer (incremental, BNLH join) Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`i2` = `test`.`t1`.`i1` and `test`.`t3`.`i3` = `test`.`t1`.`i1` and `test`.`t1`.`i1` is not null and `test`.`t1`.`i1` is not null) where `test`.`t3`.`d3` = 0 or `test`.`t3`.`d3` is null DROP TABLE t1,t2,t3; @@ -2247,10 +2247,10 @@ INSERT INTO t3 VALUES (3),(8); EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a WHERE b IN (1,2,3) OR b = d; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 const 2 100.00 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t3 NULL hash_ALL NULL #hash#$hj 5 const 2 100.00 Using where; Using join buffer (flat, BNLH join) Warnings: Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`d` = 10 and 10 is not null) where `test`.`t2`.`c` = 8 and `test`.`t3`.`d` = 8 SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a @@ -2271,19 +2271,19 @@ from t1 A, t1 B, t1 C; delete from t1 where a=0; # Check that there are different #rows of NULLs for b and c, both !=10: explain select * from t2 force index (b) where b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref b b 5 const 780 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref b b 5 const 780 Using index condition explain select * from t2 force index (c) where c is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref c c 5 const 393 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref c c 5 const 393 Using index condition explain select * from t1 left join t2 on t2.b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 9 -1 SIMPLE t2 ALL b NULL NULL NULL 1000 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 9 +1 SIMPLE t2 NULL ALL b NULL NULL NULL 1000 Using where; Using join buffer (flat, BNL join) explain select * from t1 left join t2 on t2.c is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 9 -1 SIMPLE t2 ALL c NULL NULL NULL 1000 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 9 +1 SIMPLE t2 NULL ALL c NULL NULL NULL 1000 Using where; Using join buffer (flat, BNL join) drop table t1,t2; # # MDEV-10006: optimizer doesn't convert outer join to inner on views with WHERE clause @@ -2323,10 +2323,10 @@ FROM t1 JOIN t2 on t1.i1 = t2.i2 LEFT JOIN t3 on t2.i2 = t3.i3 ) as w1 WHERE v3 = 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ref PRIMARY,v3 v3 5 const 1 100.00 -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ref PRIMARY,v3 v3 5 const 1 100.00 +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3` # This should have the same join order like the query above: @@ -2341,10 +2341,10 @@ WHERE t1.i1 = t2.i2 AND 1 = 1 ) as w2 WHERE v3 = 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ref PRIMARY,v3 v3 5 const 1 100.00 -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ref PRIMARY,v3 v3 5 const 1 100.00 +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3` drop table t1,t2,t3; @@ -2365,9 +2365,9 @@ SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0) FROM t t1 LEFT JOIN t t2 ON t1.x = t2.x WHERE IFNULL(t2.x,0)=0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.x 2 100.00 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 5 test.t1.x 2 100.00 Using where; Using join buffer (flat, BNLH join) Warnings: Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x` and `test`.`t1`.`x` is not null) where ifnull(`test`.`t2`.`x`,0) = 0 SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0) @@ -2381,9 +2381,9 @@ SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0) FROM t t1 LEFT JOIN t t2 ON t1.x = t2.x WHERE f(t2.x,0)=0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.x 2 100.00 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 5 test.t1.x 2 100.00 Using where; Using join buffer (flat, BNLH join) Warnings: Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x` and `test`.`t1`.`x` is not null) where `f`(`test`.`t2`.`x`,0) = 0 drop function f; @@ -2421,9 +2421,9 @@ col1 col1 col3 EXPLAIN EXTENDED SELECT t1.col1, t2.col1, t2.col3 FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2 WHERE IFNULL(t2.col3,0) = 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 17 test.t1.col1 2 100.00 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 17 test.t1.col1 2 100.00 Using where; Using join buffer (flat, BNLH join) Warnings: Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1` and `test`.`t1`.`col1` is not null) where ifnull(`test`.`t2`.`col3`,0) = 0 SELECT t1.col1, t2.col1, t2.col3 @@ -2435,9 +2435,9 @@ col1 col1 col3 EXPLAIN EXTENDED SELECT t1.col1, t2.col1, t2.col3 FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2 WHERE f1(t2.col3,0) = 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 17 test.t1.col1 2 100.00 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 17 test.t1.col1 2 100.00 Using where; Using join buffer (flat, BNLH join) Warnings: Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1` and `test`.`t1`.`col1` is not null) where `f1`(`test`.`t2`.`col3`,0) = 0 DROP FUNCTION f1; @@ -2494,8 +2494,8 @@ RIGHT JOIN ON t1.pk = t2.pk AND t2.v2 = tb1.v1 WHERE tb1.pk = 40 ORDER BY tb1.i1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select straight_join 'p' AS `v2` from `test`.`t1` join `test`.`t1` `tb1` left join `test`.`t1` `tb2` on(multiple equal(NULL, NULL)) where 0 order by NULL EXPLAIN EXTENDED @@ -2507,8 +2507,8 @@ LEFT JOIN ON t1.pk = t2.pk AND t2.v2 = tb1.v1 WHERE tb1.pk = 40 ORDER BY tb1.i1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select straight_join 'p' AS `v2` from `test`.`t1` join `test`.`t1` `tb1` left join `test`.`t1` `tb2` on(multiple equal(NULL, NULL)) where 0 order by NULL SELECT STRAIGHT_JOIN DISTINCT t2.v2 @@ -2539,9 +2539,9 @@ a b 3 3 1 NULL explain extended select * from t1 left join t2 on a=b where (b > 3) is not true; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.a 3 100.00 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 5 test.t1.a 3 100.00 Using where; Using join buffer (flat, BNLH join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) where `test`.`t2`.`b` > 3 is not true select * from t1 left join t2 on a=b where (b > 3) is not false; @@ -2549,9 +2549,9 @@ a b 7 7 1 NULL explain extended select * from t1 left join t2 on a=b where (b > 3) is not false; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.a 3 100.00 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 5 test.t1.a 3 100.00 Using where; Using join buffer (flat, BNLH join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) where `test`.`t2`.`b` > 3 is not false drop table t1,t2; @@ -2649,11 +2649,11 @@ INNER JOIN t3 ON t3.id=t2.profile_id INNER JOIN t4 ON t4.id=t3.person_id WHERE t1.timestamp < 1294664900039 AND t1.timestamp > 1294644616416 AND t2.REVTYPE=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 42 100.00 Using where -1 SIMPLE t3 ref PRIMARY PRIMARY 4 test.t2.profile_id 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t4 ref PRIMARY PRIMARY 4 test.t3.person_id 1 100.00 Using index -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.REV 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 42 100.00 Using where +1 SIMPLE t3 NULL ref PRIMARY PRIMARY 4 test.t2.profile_id 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t4 NULL ref PRIMARY PRIMARY 4 test.t3.person_id 1 100.00 Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.REV 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`timestamp` AS `timestamp`,`test`.`t1`.`modifiedBy` AS `modifiedBy`,`test`.`t2`.`id` AS `id`,`test`.`t2`.`REV` AS `REV`,`test`.`t2`.`REVTYPE` AS `REVTYPE`,`test`.`t2`.`profile_id` AS `profile_id`,`test`.`t3`.`id` AS `id`,`test`.`t3`.`REV` AS `REV`,`test`.`t3`.`person_id` AS `person_id`,`test`.`t4`.`id` AS `id`,`test`.`t4`.`REV` AS `REV` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` where `test`.`t2`.`REVTYPE` = 2 and `test`.`t4`.`id` = `test`.`t3`.`person_id` and `test`.`t3`.`id` = `test`.`t2`.`profile_id` and `test`.`t1`.`id` = `test`.`t2`.`REV` and `test`.`t1`.`timestamp` < 1294664900039 and `test`.`t1`.`timestamp` > 1294644616416 SELECT * @@ -2674,11 +2674,11 @@ RIGHT JOIN t3 ON t3.id=t2.profile_id RIGHT JOIN t4 ON t4.id=t3.person_id WHERE t1.timestamp < 1294664900039 AND t1.timestamp > 1294644616416 AND t2.REVTYPE=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 42 100.00 Using where -1 SIMPLE t3 ref PRIMARY PRIMARY 4 test.t2.profile_id 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t4 ref PRIMARY PRIMARY 4 test.t3.person_id 1 100.00 Using index -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.REV 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 42 100.00 Using where +1 SIMPLE t3 NULL ref PRIMARY PRIMARY 4 test.t2.profile_id 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t4 NULL ref PRIMARY PRIMARY 4 test.t3.person_id 1 100.00 Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.REV 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`timestamp` AS `timestamp`,`test`.`t1`.`modifiedBy` AS `modifiedBy`,`test`.`t2`.`id` AS `id`,`test`.`t2`.`REV` AS `REV`,`test`.`t2`.`REVTYPE` AS `REVTYPE`,`test`.`t2`.`profile_id` AS `profile_id`,`test`.`t3`.`id` AS `id`,`test`.`t3`.`REV` AS `REV`,`test`.`t3`.`person_id` AS `person_id`,`test`.`t4`.`id` AS `id`,`test`.`t4`.`REV` AS `REV` from `test`.`t4` join `test`.`t3` join `test`.`t2` join `test`.`t1` where `test`.`t2`.`REVTYPE` = 2 and `test`.`t1`.`id` = `test`.`t2`.`REV` and `test`.`t3`.`id` = `test`.`t2`.`profile_id` and `test`.`t4`.`id` = `test`.`t3`.`person_id` and `test`.`t1`.`timestamp` < 1294664900039 and `test`.`t1`.`timestamp` > 1294644616416 SELECT * @@ -2775,15 +2775,15 @@ create table t3 (a int, b int, key(a)); insert into t3 select A.a + B.a* 10 + C.a * 100, 12345 from t1 A, t1 B, t1 C; # Uses range for table t3: explain select * from t1 left join t3 on t1.a=t3.b and t3.a<5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 -1 SIMPLE t3 hash_range a #hash#$hj:a 5:5 test.t1.a 5 Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t3 NULL hash_range a #hash#$hj:a 5:5 test.t1.a 5 Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join) # This must use range for table t3, too: explain select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 hash_range a #hash#$hj:a 5:5 test.t1.a 5 Using where; Rowid-ordered scan; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL hash_range a #hash#$hj:a 5:5 test.t1.a 5 Using where; Rowid-ordered scan; Using join buffer (incremental, BNLH join) # # .. part 2: make sure condition selectivity can use the condition too. # @@ -2800,17 +2800,17 @@ test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK # t3.filtered is less than 100%: explain extended select * from t1 left join t3 on t1.a=t3.b and t3.a<5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 -1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.a 1000 0.50 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 +1 SIMPLE t3 NULL hash_ALL NULL #hash#$hj 5 test.t1.a 1000 0.50 Using where; Using join buffer (flat, BNLH join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`a` < 5 and `test`.`t1`.`a` is not null) where 1 # t3.filtered must less than 100%, too: explain extended select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.a 1000 0.50 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL hash_ALL NULL #hash#$hj 5 test.t1.a 1000 0.50 Using where; Using join buffer (incremental, BNLH join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t3` join `test`.`t2`) on(`test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`a` < 5 and `test`.`t1`.`a` is not null) where 1 drop table t1,t2,t3; diff --git a/mysql-test/main/key.result b/mysql-test/main/key.result index ff35288a6ea..5f34c5ec51b 100644 --- a/mysql-test/main/key.result +++ b/mysql-test/main/key.result @@ -211,18 +211,18 @@ drop table t1; CREATE TABLE t1 (id int unsigned auto_increment, name char(50), primary key (id)) engine=myisam; insert into t1 (name) values ('a'), ('b'),('c'),('d'),('e'),('f'),('g'); explain select 1 from t1 where id =2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index explain select 1 from t1 where id =2 or id=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Using index explain select name from t1 where id =2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 ALTER TABLE t1 DROP PRIMARY KEY, ADD INDEX (id); explain select 1 from t1 where id =2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref id id 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref id id 4 const 1 Using index drop table t1; CREATE TABLE t1 (numeropost mediumint(8) unsigned NOT NULL default '0', numreponse int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (numeropost,numreponse), UNIQUE KEY numreponse (numreponse)); INSERT INTO t1 (numeropost,numreponse) VALUES ('1','1'),('1','2'),('2','3'),('2','4'); @@ -230,8 +230,8 @@ SELECT numeropost FROM t1 WHERE numreponse='1'; numeropost 1 EXPLAIN SELECT numeropost FROM t1 WHERE numreponse='1'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const numreponse numreponse 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const numreponse numreponse 4 const 1 Using index FLUSH TABLES; SELECT numeropost FROM t1 WHERE numreponse='1'; numeropost @@ -493,8 +493,8 @@ CREATE TABLE t1( a TINYINT, KEY(a) ) ENGINE=MyISAM; INSERT INTO t1 VALUES( 1 ); ALTER TABLE t1 DISABLE KEYS; EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 drop table t1; CREATE TABLE t1 ( a INTEGER auto_increment PRIMARY KEY, @@ -608,9 +608,9 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range a a 5 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL range a a 5 NULL 5 Using where; Using index SELECT 1 as RES FROM t1 AS t1_outer WHERE (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12; RES @@ -624,20 +624,20 @@ DROP TABLE t1; CREATE TABLE t1( a INT, b INT, KEY( a ) ); INSERT INTO t1 values (1, 2), (1, 3), (2, 3), (2, 4), (3, 4), (3, 5); EXPLAIN SELECT a, SUM( b ) FROM t1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using temporary; Using filesort SHOW STATUS LIKE 'Last_query_cost'; Variable_name Value Last_query_cost 9.212184 EXPLAIN SELECT a, SUM( b ) FROM t1 USE INDEX( a ) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using temporary; Using filesort SHOW STATUS LIKE 'Last_query_cost'; Variable_name Value Last_query_cost 9.212184 EXPLAIN SELECT a, SUM( b ) FROM t1 FORCE INDEX( a ) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 6 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 6 SHOW STATUS LIKE 'Last_query_cost'; Variable_name Value Last_query_cost 14.199000 @@ -650,9 +650,9 @@ insert into t1 select seq, seq, seq from seq_1_to_10; create table t2(a int, b int,c int); insert into t2 select seq, seq, seq+1 from seq_1_to_100; EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where -1 SIMPLE t1 eq_ref b b 10 test.t2.a,test.t2.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE t1 NULL eq_ref b b 10 test.t2.a,test.t2.b 1 Using index SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; c c 1 2 @@ -668,9 +668,9 @@ c c alter table t1 drop PRIMARY KEY; alter table t1 add PRIMARY KEY(b,c); EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where -1 SIMPLE t1 eq_ref PRIMARY,b PRIMARY 8 test.t2.a,test.t2.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY,b PRIMARY 8 test.t2.a,test.t2.b 1 Using index SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; c c 1 2 diff --git a/mysql-test/main/key_cache.result b/mysql-test/main/key_cache.result index c8bdc979387..06a9d1887fa 100644 --- a/mysql-test/main/key_cache.result +++ b/mysql-test/main/key_cache.result @@ -116,15 +116,15 @@ cache index t1 key (`primary`) in keycache1; Table Op Msg_type Msg_text test.t1 assign_to_keycache status OK explain select p from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 Using index select p from t1; p 2 11 explain select i from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL k1 5 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL k1 5 NULL 4 Using index select i from t2; i 2 @@ -132,9 +132,9 @@ i 2 3 explain select count(*) from t1, t2 where t1.p = t2.i; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using index -1 SIMPLE t2 ref k1 k1 5 test.t1.p 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 4 NULL 2 Using index +1 SIMPLE t2 NULL ref k1 k1 5 test.t1.p 2 Using index select count(*) from t1, t2 where t1.p = t2.i; count(*) 3 @@ -158,8 +158,8 @@ p i a 3000 3 zzzz 2000 3 yyyy explain select p from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL PRIMARY 4 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 5 Using index select p from t2; p 2 @@ -168,8 +168,8 @@ p 2000 3000 explain select i from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL k1 5 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL k1 5 NULL 5 Using index select i from t2; i 2 @@ -178,8 +178,8 @@ i 3 3 explain select a from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL k2 11 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL k2 11 NULL 5 Using index select a from t2; a pppp @@ -228,8 +228,8 @@ p 2000 4000 explain select i from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL k1 5 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL k1 5 NULL 5 Using index select i from t2; i 2 @@ -238,8 +238,8 @@ i 3 3 explain select a from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL k2 11 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL k2 11 NULL 5 Using index select a from t2; a pppp @@ -656,13 +656,13 @@ cache index t1 key (`primary`) in keycache1; Table Op Msg_type Msg_text test.t1 assign_to_keycache status OK explain select p from t1 where p between 1010 and 1020; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 1 Using where; Using index select p from t1 where p between 1010 and 1020; p explain select i from t2 where p between 1010 and 1020; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 9 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 9 Using index condition select i from t2 where p between 1010 and 1020; i 1 @@ -677,9 +677,9 @@ i 1 3 explain select count(*) from t1, t2 where t1.p = t2.i; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index k1 k1 5 NULL 1024 Using where; Using index -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.i 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index k1 k1 5 NULL 1024 Using where; Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.i 1 Using index select count(*) from t1, t2 where t1.p = t2.i; count(*) 256 @@ -727,8 +727,8 @@ p i a 1018 1 pppp 1019 1 yyyy explain select p from t2 where p between 1010 and 1020; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 8 Using where; Using index select p from t2 where p between 1010 and 1020; p 1010 @@ -738,14 +738,14 @@ p 1018 1019 explain select i from t2 where a='yyyy' and i=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index_merge k1,k2 k1,k2 5,11 NULL 50 Using intersect(k1,k2); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index_merge k1,k2 k1,k2 5,11 NULL 50 Using intersect(k1,k2); Using where; Using index select i from t2 where a='yyyy' and i=3; i 3 explain select a from t2 where a='yyyy' and i=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index_merge k1,k2 k1,k2 5,11 NULL 50 Using intersect(k1,k2); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index_merge k1,k2 k1,k2 5,11 NULL 50 Using intersect(k1,k2); Using where; Using index select a from t2 where a='yyyy' and i=3 ; a yyyy diff --git a/mysql-test/main/key_diff.result b/mysql-test/main/key_diff.result index af928fcb203..378ad4d25ee 100644 --- a/mysql-test/main/key_diff.result +++ b/mysql-test/main/key_diff.result @@ -34,9 +34,9 @@ C c a a D E a a a a a a explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a NULL NULL NULL 5 -1 SIMPLE t2 ALL b NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 5 +1 SIMPLE t2 NULL ALL b NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a; a b a b A B a a diff --git a/mysql-test/main/key_primary.result b/mysql-test/main/key_primary.result index 7726a8e1d63..097a6ae2d2c 100644 --- a/mysql-test/main/key_primary.result +++ b/mysql-test/main/key_primary.result @@ -12,9 +12,9 @@ select * from t1 where t1 like "a_\%"; t1 AB% describe select * from t1 where t1="ABC"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 3 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 3 const 1 Using index describe select * from t1 where t1="ABCD"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables drop table t1; diff --git a/mysql-test/main/limit.result b/mysql-test/main/limit.result index b47644eb40d..7d728602e92 100644 --- a/mysql-test/main/limit.result +++ b/mysql-test/main/limit.result @@ -79,14 +79,14 @@ drop table t1; create table t1 (a int); insert into t1 values (1),(2),(3),(4),(5),(6),(7); explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 Using where select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3; c 7 explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 Using where select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3; c 28 @@ -151,14 +151,14 @@ End of 5.1 tests # EXPLAIN SELECT * FROM mysql.slow_log WHERE sql_text != 'foo' LIMIT 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Zero limit SELECT * FROM mysql.slow_log WHERE sql_text != 'foo' LIMIT 0; start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected EXPLAIN SELECT * FROM mysql.help_topic WHERE help_category_id != example LIMIT 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Zero limit SELECT * FROM mysql.help_topic WHERE help_category_id != example LIMIT 0; help_topic_id name help_category_id description example url End of 5.5 tests diff --git a/mysql-test/main/limit_rows_examined.result b/mysql-test/main/limit_rows_examined.result index f0a22b8f3f2..1c0214a5be4 100644 --- a/mysql-test/main/limit_rows_examined.result +++ b/mysql-test/main/limit_rows_examined.result @@ -15,9 +15,9 @@ Simple nested loops join without blocking set @@join_cache_level=0; explain select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 Using where select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 2; c1 c2 bb bb @@ -25,9 +25,9 @@ Warnings: Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete explain select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1i index PRIMARY PRIMARY 2 NULL 4 Using index -1 SIMPLE t2i eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1i NULL index PRIMARY PRIMARY 2 NULL 4 Using index +1 SIMPLE t2i NULL eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 4; c1 c2 bb bb @@ -37,9 +37,9 @@ Blocked nested loops join, empty result set because of blocking set @@join_cache_level=1; explain select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 6; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 6; c1 c2 bb bb @@ -47,9 +47,9 @@ Warnings: Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete explain select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1i index PRIMARY PRIMARY 2 NULL 4 Using index -1 SIMPLE t2i eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1i NULL index PRIMARY PRIMARY 2 NULL 4 Using index +1 SIMPLE t2i NULL eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6; c1 c2 bb bb @@ -59,18 +59,18 @@ Warning 1931 Query execution was interrupted. The query examined at least 7 rows set @@join_cache_level=6; explain select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -1 SIMPLE t2 hash_ALL NULL #hash#$hj 3 test.t1.c1 4 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 3 test.t1.c1 4 Using where; Using join buffer (flat, BNLH join) select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 3; c1 c2 Warnings: Warning 1931 Query execution was interrupted. The query examined at least 4 rows, which exceeds LIMIT ROWS EXAMINED (3). The query result may be incomplete explain select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1i index PRIMARY PRIMARY 2 NULL 4 Using index -1 SIMPLE t2i eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1i NULL index PRIMARY PRIMARY 2 NULL 4 Using index +1 SIMPLE t2i NULL eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6; c1 c2 bb bb @@ -81,17 +81,17 @@ Mix LIMIT ROWS EXAMINED with LIMIT set @@join_cache_level=0; explain select * from t1, t2 where c1 < c2 LIMIT 1 ROWS EXAMINED 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 Using where select * from t1, t2 where c1 < c2 LIMIT 1 ROWS EXAMINED 4; c1 c2 bb cc explain select * from t1, t2 where c1 < c2 LIMIT 1,1 ROWS EXAMINED 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 Using where select * from t1, t2 where c1 < c2 LIMIT 1,1 ROWS EXAMINED 4; c1 c2 bb dd @@ -99,12 +99,12 @@ Empty table optimized away during constant optimization create table t0 (c0 int); explain select * from t0 LIMIT ROWS EXAMINED 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL system NULL NULL NULL NULL 0 Const row not found explain select * from t0 LIMIT ROWS EXAMINED 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL system NULL NULL NULL NULL 0 Const row not found select * from t0 LIMIT ROWS EXAMINED 1; c0 drop table t0; @@ -112,16 +112,16 @@ create table t0 (c0 char(2) primary key); insert into t0 values ('bb'), ('cc'), ('aa'); explain select * from t0 where c0 = 'bb' LIMIT ROWS EXAMINED 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 const PRIMARY PRIMARY 2 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL const PRIMARY PRIMARY 2 const 1 Using index select * from t0 where c0 = 'bb' LIMIT ROWS EXAMINED 0; c0 bb explain select * from t0, t1 where c0 = 'bb' and c1 > c0 LIMIT ROWS EXAMINED 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 const PRIMARY PRIMARY 2 const 1 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL const PRIMARY PRIMARY 2 const 1 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where select * from t0, t1 where c0 = 'bb' and c1 > c0 LIMIT ROWS EXAMINED 0; c0 c1 Warnings: @@ -210,10 +210,10 @@ Subqueries, semi-join explain select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 11); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 2 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 2 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 11); c1 @@ -224,10 +224,10 @@ explain select * from t1 where c1 IN (select * from t2 where c2 > ' ') LIMIT ROWS EXAMINED 11; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 2 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 2 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where select * from t1 where c1 IN (select * from t2 where c2 > ' ') LIMIT ROWS EXAMINED 11; @@ -239,10 +239,10 @@ explain select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0) LIMIT ROWS EXAMINED 11; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 2 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 2 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0) LIMIT ROWS EXAMINED 11; @@ -254,9 +254,9 @@ explain select * from t1i where c1 IN (select * from t2i where c2 > ' ') LIMIT ROWS EXAMINED 6; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1i range PRIMARY PRIMARY 2 NULL 4 Using where; Using index -1 PRIMARY t2i eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1i NULL range PRIMARY PRIMARY 2 NULL 4 Using where; Using index +1 PRIMARY t2i NULL eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index select * from t1i where c1 IN (select * from t2i where c2 > ' ') LIMIT ROWS EXAMINED 6; @@ -270,9 +270,9 @@ set @@optimizer_switch='semijoin=off,in_to_exists=on,materialization=off'; explain select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 Using where select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 4); c1 @@ -283,9 +283,9 @@ explain select * from t1 where c1 IN (select * from t2 where c2 > ' ') LIMIT ROWS EXAMINED 4; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 Using where select * from t1 where c1 IN (select * from t2 where c2 > ' ') LIMIT ROWS EXAMINED 4; @@ -297,9 +297,9 @@ explain select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0) LIMIT ROWS EXAMINED 4; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 Using where select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0) LIMIT ROWS EXAMINED 4; @@ -311,9 +311,9 @@ explain select * from t1i where c1 IN (select * from t2i where c2 > ' ') LIMIT ROWS EXAMINED 9; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1i index NULL PRIMARY 2 NULL 4 Using where; Using index -2 DEPENDENT SUBQUERY t2i unique_subquery PRIMARY PRIMARY 2 func 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1i NULL index NULL PRIMARY 2 NULL 4 Using where; Using index +2 DEPENDENT SUBQUERY t2i NULL unique_subquery PRIMARY PRIMARY 2 func 1 Using index; Using where select * from t1i where c1 IN (select * from t2i where c2 > ' ') LIMIT ROWS EXAMINED 9; @@ -355,9 +355,9 @@ set @@optimizer_switch='semijoin=off,in_to_exists=off,materialization=on,subquer explain select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 13); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 13); c1 @@ -367,9 +367,9 @@ Warning 1931 Query execution was interrupted. The query examined at least 14 row explain select * from t1 where c1 IN (select * from t2 where c2 > ' ') LIMIT ROWS EXAMINED 13; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where select * from t1 where c1 IN (select * from t2 where c2 > ' ') LIMIT ROWS EXAMINED 13; c1 @@ -380,9 +380,9 @@ explain select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0) LIMIT ROWS EXAMINED 13; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0) LIMIT ROWS EXAMINED 13; @@ -393,9 +393,9 @@ Warning 1931 Query execution was interrupted. The query examined at least 14 row explain select * from t1i where c1 IN (select * from t2i where c2 > ' ') LIMIT ROWS EXAMINED 17; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1i index NULL PRIMARY 2 NULL 4 Using where; Using index -2 MATERIALIZED t2i range PRIMARY PRIMARY 2 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1i NULL index NULL PRIMARY 2 NULL 4 Using where; Using index +2 MATERIALIZED t2i NULL range PRIMARY PRIMARY 2 NULL 4 Using where; Using index select * from t1i where c1 IN (select * from t2i where c2 > ' ') LIMIT ROWS EXAMINED 17; c1 @@ -440,10 +440,10 @@ select * from (select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)) as tmp LIMIT ROWS EXAMINED 11; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 2 func 1 -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 2 func 1 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 Using where select * from (select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)) as tmp @@ -461,16 +461,16 @@ insert into t3 values ('bb', 3), ('bb', 4), ('bb', 5); explain select c1, sum(c2) from t3 group by c1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 Using temporary; Using filesort select c1, sum(c2) from t3 group by c1; c1 sum(c2) aa 3 bb 12 explain select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 Using temporary; Using filesort select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 0; c1 sum(c2) Warnings: @@ -496,8 +496,8 @@ insert into t3i values ('bb', 3), ('bb', 4), ('bb', 5); explain select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3i index NULL it3j 8 NULL 5 Using index; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3i NULL index NULL it3j 8 NULL 5 Using index; Using temporary; Using filesort select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 0; c1 sum(c2) Warnings: @@ -518,8 +518,8 @@ bb 12 Aggregation without grouping explain select min(c2) from t3 LIMIT ROWS EXAMINED 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 select min(c2) from t3 LIMIT ROWS EXAMINED 5; min(c2) Warnings: @@ -533,8 +533,8 @@ Warnings: Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete explain select max(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 Using where select max(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5; max(c2) Warnings: @@ -548,8 +548,8 @@ Warnings: Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete explain select count(c2) from t3 LIMIT ROWS EXAMINED 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 select count(c2) from t3 LIMIT ROWS EXAMINED 5; count(c2) Warnings: @@ -563,8 +563,8 @@ Warnings: Warning 1931 Query execution was interrupted. The query examined at least 1 rows, which exceeds LIMIT ROWS EXAMINED (0). The query result may be incomplete explain select count(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 Using where select count(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5; count(c2) Warnings: @@ -574,8 +574,8 @@ count(c2) 0 explain select sum(c2) from t3 LIMIT ROWS EXAMINED 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 select sum(c2) from t3 LIMIT ROWS EXAMINED 5; sum(c2) Warnings: @@ -586,16 +586,16 @@ sum(c2) The query result is found during optimization, LIMIT ROWS EXAMINED has no effect. explain select max(c1) from t3i LIMIT ROWS EXAMINED 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select max(c1) from t3i LIMIT ROWS EXAMINED 0; max(c1) bb create table t3_empty like t3; explain select max(c1) from t3_empty LIMIT ROWS EXAMINED 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3_empty system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3_empty NULL system NULL NULL NULL NULL 0 Const row not found select max(c1) from t3_empty LIMIT ROWS EXAMINED 0; max(c1) NULL @@ -605,14 +605,14 @@ Sorting ========================================================================= explain select c1, c2 from t3 order by c2, c1 LIMIT ROWS EXAMINED 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 5 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 Using filesort select c1, c2 from t3 order by c2, c1 LIMIT ROWS EXAMINED 2; ERROR HY000: Sort aborted: explain select c1, c2 from t3i order by c2, c1 LIMIT ROWS EXAMINED 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3i index NULL it3j 8 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3i NULL index NULL it3j 8 NULL 5 Using index select c1, c2 from t3i order by c2, c1 LIMIT ROWS EXAMINED 2; c1 c2 aa 1 @@ -621,8 +621,8 @@ Warnings: Warning 1931 Query execution was interrupted. The query examined at least 3 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete explain select c1, c2 from t3i order by c2, c1 desc LIMIT ROWS EXAMINED 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3i index NULL it3j 8 NULL 5 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3i NULL index NULL it3j 8 NULL 5 Using index; Using filesort select c1, c2 from t3i order by c2, c1 desc LIMIT ROWS EXAMINED 2; ERROR HY000: Sort aborted: drop table t3,t3i; @@ -682,11 +682,11 @@ EXPLAIN SELECT DISTINCT a AS field1 FROM t1, t2 WHERE EXISTS (SELECT c FROM t3 LEFT JOIN t2 ON b = d) HAVING field1 > 'aaa' LIMIT ROWS EXAMINED 20; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) SELECT DISTINCT a AS field1 FROM t1, t2 WHERE EXISTS (SELECT c FROM t3 LEFT JOIN t2 ON b = d) HAVING field1 > 'aaa' LIMIT ROWS EXAMINED 20; @@ -695,9 +695,9 @@ Warnings: Warning 1931 Query execution was interrupted. The query examined at least 21 rows, which exceeds LIMIT ROWS EXAMINED (20). The query result may be incomplete EXPLAIN SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 14; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 14; a USA @@ -738,13 +738,13 @@ FROM t1, t2 AS alias2, t2 AS alias3 WHERE alias3.c IN ( SELECT 1 UNION SELECT 6 ) GROUP BY field1, field2, field3, field4, field5 LIMIT ROWS EXAMINED 120; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort -1 PRIMARY alias2 ALL NULL NULL NULL NULL 7 Using join buffer (flat, BNL join) -1 PRIMARY alias3 index NULL c 5 NULL 7 Using where; Using index; Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using temporary; Using filesort +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 7 Using join buffer (flat, BNL join) +1 PRIMARY alias3 NULL index NULL c 5 NULL 7 Using where; Using index; Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL FLUSH STATUS; SELECT a AS field1, alias2.d AS field2, alias2.f AS field3, alias2.e AS field4, b AS field5 FROM t1, t2 AS alias2, t2 AS alias3 @@ -888,9 +888,9 @@ insert into t1 values ('bb'), ('cc'), ('aa'), ('dd'); insert into t2 values ('bb'), ('cc'), ('dd'), ('ff'); explain extended select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c2` = `test`.`t1`.`c1` drop table t1,t2; diff --git a/mysql-test/main/long_unique.result b/mysql-test/main/long_unique.result index a2484f59202..9e55899c1e1 100644 --- a/mysql-test/main/long_unique.result +++ b/mysql-test/main/long_unique.result @@ -1430,9 +1430,9 @@ CREATE TABLE t2 (f varchar(10), a2 datetime, b int, a1 varchar(1024), pk int NOT INSERT INTO t2 VALUES ('aaa','1985-09-06',-163,'s',1),('bbb','1995-01-05',3,'pucaz',2),('ccc','0000-00-00',NULL,'help',3),('ddd',NULL,618,'v',4),('eee','1995-12-20',410,'m',5),('ffq','1976-06-12 20:02:56',NULL,'POKNC',6),('dddd','0000-00-00',-328,'hgsu',7); explain SELECT t2.b FROM t1 JOIN t2 ON t1.d = t2.f WHERE t2.pk >= 20; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY,f,f2 PRIMARY 4 NULL 1 Using index condition -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range PRIMARY,f,f2 PRIMARY 4 NULL 1 Using index condition +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) SELECT t2.b FROM t1 JOIN t2 ON t1.d = t2.f WHERE t2.pk >= 20; b drop table t1,t2; diff --git a/mysql-test/main/mdev-25830.result b/mysql-test/main/mdev-25830.result index e62d1ff3f55..1c681fd2b26 100644 --- a/mysql-test/main/mdev-25830.result +++ b/mysql-test/main/mdev-25830.result @@ -23,10 +23,10 @@ WHERE task2.`sys_id` LIKE '8e7792a7dbfffb00fff8a345ca961934%' OR sysapproval_approver0.`sys_domain_path` LIKE '!!!/!!!/%' ) ORDER BY sysapproval_approver0.`order` LIMIT 0, 50 ; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE task2 range PRIMARY,sys_class_name_2,sys_domain_path PRIMARY 96 NULL 1 0.00 100.00 100.00 Using where; Using temporary; Using filesort -1 SIMPLE task1 ref PRIMARY,task_parent,sys_class_name_2,sys_domain_path task_parent 99 test.task2.sys_id 1 NULL 100.00 NULL Using index condition; Using where -1 SIMPLE sysapproval_approver0 ref sysapproval_approver_ref5,sys_domain_path,sysapproval_approver_CHG1975376 sysapproval_approver_ref5 99 test.task1.sys_id 1 NULL 100.00 NULL Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE task2 NULL range PRIMARY,sys_class_name_2,sys_domain_path PRIMARY 96 NULL 1 0.00 100.00 100.00 Using where; Using temporary; Using filesort +1 SIMPLE task1 NULL ref PRIMARY,task_parent,sys_class_name_2,sys_domain_path task_parent 99 test.task2.sys_id 1 NULL 100.00 NULL Using index condition; Using where +1 SIMPLE sysapproval_approver0 NULL ref sysapproval_approver_ref5,sys_domain_path,sysapproval_approver_CHG1975376 sysapproval_approver_ref5 99 test.task1.sys_id 1 NULL 100.00 NULL Using index condition; Using where set optimizer_use_condition_selectivity=4; analyze SELECT sysapproval_approver0.`sys_id` FROM ((sysapproval_approver sysapproval_approver0 @@ -46,10 +46,10 @@ WHERE task2.`sys_id` LIKE '8e7792a7dbfffb00fff8a345ca961934%' OR sysapproval_approver0.`sys_domain_path` LIKE '!!!/!!!/%' ) ORDER BY sysapproval_approver0.`order` LIMIT 0, 50 ; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE task2 range PRIMARY,sys_class_name_2,sys_domain_path PRIMARY 96 NULL 1 0.00 98.00 100.00 Using where; Using temporary; Using filesort -1 SIMPLE task1 ref PRIMARY,task_parent,sys_class_name_2,sys_domain_path task_parent 99 test.task2.sys_id 1 NULL 100.00 NULL Using index condition; Using where -1 SIMPLE sysapproval_approver0 ref sysapproval_approver_ref5,sys_domain_path,sysapproval_approver_CHG1975376 sysapproval_approver_ref5 99 test.task1.sys_id 1 NULL 100.00 NULL Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE task2 NULL range PRIMARY,sys_class_name_2,sys_domain_path PRIMARY 96 NULL 1 0.00 98.00 100.00 Using where; Using temporary; Using filesort +1 SIMPLE task1 NULL ref PRIMARY,task_parent,sys_class_name_2,sys_domain_path task_parent 99 test.task2.sys_id 1 NULL 100.00 NULL Using index condition; Using where +1 SIMPLE sysapproval_approver0 NULL ref sysapproval_approver_ref5,sys_domain_path,sysapproval_approver_CHG1975376 sysapproval_approver_ref5 99 test.task1.sys_id 1 NULL 100.00 NULL Using index condition; Using where drop table sysapproval_approver,task; set global innodb_stats_persistent= @innodb_stats_persistent_save; set global innodb_stats_persistent_sample_pages= diff --git a/mysql-test/main/mdev13607.result b/mysql-test/main/mdev13607.result index dcb7365644a..e1edb68c1cd 100644 --- a/mysql-test/main/mdev13607.result +++ b/mysql-test/main/mdev13607.result @@ -53,420 +53,420 @@ INNER JOIN INNER JOIN (SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_16 ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY r1 ALL NULL NULL NULL NULL 2 -1 PRIMARY d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -1 PRIMARY r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -1 PRIMARY <derived4> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -1 PRIMARY <derived5> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -1 PRIMARY <derived6> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -1 PRIMARY <derived7> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -1 PRIMARY <derived8> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -1 PRIMARY <derived9> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -1 PRIMARY <derived10> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -1 PRIMARY <derived11> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -1 PRIMARY <derived12> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -1 PRIMARY <derived13> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -1 PRIMARY <derived14> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -1 PRIMARY <derived15> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -1 PRIMARY <derived16> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -1 PRIMARY <derived17> ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) -17 DERIVED r1 ALL NULL NULL NULL NULL 2 -17 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -17 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -17 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -17 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -17 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -17 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -17 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -17 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -17 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -17 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -17 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -17 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -17 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -17 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -17 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -17 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -17 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -17 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -17 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -17 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -17 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -17 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -17 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -17 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -16 DERIVED r1 ALL NULL NULL NULL NULL 2 -16 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -16 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -16 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -16 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -16 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -16 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -16 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -16 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -16 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -16 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -16 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -16 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -16 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -16 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -16 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -16 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -16 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -16 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -16 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -16 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -16 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -16 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -16 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -16 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -15 DERIVED r1 ALL NULL NULL NULL NULL 2 -15 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -15 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -15 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -15 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -15 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -15 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -15 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -15 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -15 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -15 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -15 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -15 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -15 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -15 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -15 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -15 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -15 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -15 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -15 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -15 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -15 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -15 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -15 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -15 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -14 DERIVED r1 ALL NULL NULL NULL NULL 2 -14 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -14 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -14 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -14 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -14 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -14 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -14 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -14 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -14 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -14 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -14 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -14 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -14 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -14 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -14 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -14 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -14 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -14 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -14 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -14 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -14 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -14 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -14 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -14 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -13 DERIVED r1 ALL NULL NULL NULL NULL 2 -13 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -13 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -13 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -13 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -13 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -13 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -13 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -13 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -13 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -13 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -13 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -13 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -13 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -13 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -13 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -13 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -13 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -13 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -13 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -13 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -13 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -13 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -13 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -13 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -12 DERIVED r1 ALL NULL NULL NULL NULL 2 -12 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -12 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -12 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -12 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -12 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -12 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -12 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -12 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -12 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -12 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -12 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -12 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -12 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -12 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -12 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -12 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -12 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -12 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -12 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -12 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -12 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -12 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -12 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -12 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -11 DERIVED r1 ALL NULL NULL NULL NULL 2 -11 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -11 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -11 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -11 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -11 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -11 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -11 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -11 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -11 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -11 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -11 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -11 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -11 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -11 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -11 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -11 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -11 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -11 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -11 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -11 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -11 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -11 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -11 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -11 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -10 DERIVED r1 ALL NULL NULL NULL NULL 2 -10 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -10 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -10 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -10 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -10 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -10 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -10 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -10 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -10 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -10 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -10 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -10 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -10 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -10 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -10 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -10 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -10 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -10 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -10 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -10 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -10 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -10 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -10 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -10 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -9 DERIVED r1 ALL NULL NULL NULL NULL 2 -9 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -9 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -9 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -9 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -9 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -9 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -9 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -9 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -9 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -9 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -9 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -9 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -9 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -9 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -9 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -9 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -9 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -9 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -9 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -9 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -9 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -9 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -9 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -9 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -8 DERIVED r1 ALL NULL NULL NULL NULL 2 -8 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -8 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -8 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -8 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -8 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -8 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -8 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -8 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -8 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -8 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -8 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -8 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -8 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -8 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -8 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -8 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -7 DERIVED r1 ALL NULL NULL NULL NULL 2 -7 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -7 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -7 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -7 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -7 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -7 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -7 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -7 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -7 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -7 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -7 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -7 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -7 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -7 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -7 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -7 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -6 DERIVED r1 ALL NULL NULL NULL NULL 2 -6 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -6 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -6 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -6 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -6 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -6 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -6 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -6 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -6 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -6 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -6 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -6 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -6 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -6 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -6 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -6 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -6 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -6 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -6 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -6 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -6 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -6 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -6 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -6 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -5 DERIVED r1 ALL NULL NULL NULL NULL 2 -5 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -5 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -5 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -5 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -5 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -5 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -5 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -5 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -5 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -5 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -5 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -5 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -5 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -5 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -5 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -5 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -5 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -5 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -5 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -5 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -5 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -5 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -5 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -5 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -4 DERIVED r1 ALL NULL NULL NULL NULL 2 -4 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -4 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -4 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -4 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -4 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -4 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -4 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -4 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -4 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -4 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -4 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -4 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -4 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -4 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -4 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -4 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -4 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -4 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -4 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -4 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -4 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -4 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -4 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -4 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -3 DERIVED r1 ALL NULL NULL NULL NULL 2 -3 DERIVED d1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 DERIVED r2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -3 DERIVED d2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -3 DERIVED r3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -3 DERIVED d3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -3 DERIVED r4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -3 DERIVED d4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -3 DERIVED r5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -3 DERIVED d5 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -3 DERIVED r6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -3 DERIVED d6 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -3 DERIVED r7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -3 DERIVED d7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -3 DERIVED r8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -3 DERIVED d8 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -3 DERIVED p1 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -3 DERIVED p2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -3 DERIVED p3 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -3 DERIVED p4 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -3 DERIVED p5 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -3 DERIVED p6 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -3 DERIVED p7 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -3 DERIVED p8 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) -3 DERIVED p9 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY r1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 PRIMARY r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived5> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived6> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived7> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived8> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived9> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived10> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived11> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived12> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived13> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived14> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived15> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived16> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +1 PRIMARY <derived17> NULL ALL NULL NULL NULL NULL 18446744073709551615 Using join buffer (incremental, BNL join) +17 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +17 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +17 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +17 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +17 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +17 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +17 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +17 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +17 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +17 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +17 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +17 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +17 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +17 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +17 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +17 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +16 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +16 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +16 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +16 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +16 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +16 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +16 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +16 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +16 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +16 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +16 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +16 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +16 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +16 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +16 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +16 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +15 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +15 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +15 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +15 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +15 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +15 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +15 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +15 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +15 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +15 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +15 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +15 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +15 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +15 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +15 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +15 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +14 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +14 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +14 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +14 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +14 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +14 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +14 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +14 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +14 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +14 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +14 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +14 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +14 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +14 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +14 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +14 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +13 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +13 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +13 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +13 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +13 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +13 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +13 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +13 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +13 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +13 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +13 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +13 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +13 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +13 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +13 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +13 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +12 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +12 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +12 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +12 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +12 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +12 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +12 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +12 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +12 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +12 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +12 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +12 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +12 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +12 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +12 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +12 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +11 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +11 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +11 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +11 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +11 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +11 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +11 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +11 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +11 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +11 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +11 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +11 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +11 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +11 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +11 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +11 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +10 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +10 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +10 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +10 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +10 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +10 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +10 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +10 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +10 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +10 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +10 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +10 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +10 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +10 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +10 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +10 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +9 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +9 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +9 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +9 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +9 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +9 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +9 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +9 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +9 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +9 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +9 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +9 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +9 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +9 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +9 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +9 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +8 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +8 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +8 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +8 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +8 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +8 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +8 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +8 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +8 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +8 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +8 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +8 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +8 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +8 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +8 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +8 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +7 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +7 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +7 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +7 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +7 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +7 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +7 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +7 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +7 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +7 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +7 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +7 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +7 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +7 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +7 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +7 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +6 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +6 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +6 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +6 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +6 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +6 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +6 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +6 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +6 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +6 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +6 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +6 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +6 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +6 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +6 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +6 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +5 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +5 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +5 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +5 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +5 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +5 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +5 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +5 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +5 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +5 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +5 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +5 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +5 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +5 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +5 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +5 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +4 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +4 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +4 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +4 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +4 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +4 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +4 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +4 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +4 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +4 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +4 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +4 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +4 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +4 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +4 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +4 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +3 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 +3 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +3 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +3 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +3 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +3 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +3 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +3 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +3 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +3 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +3 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +3 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +3 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +3 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +3 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 Using where; Using join buffer (incremental, BNL join) DROP TABLE t1,t2,t3; diff --git a/mysql-test/main/merge.result b/mysql-test/main/merge.result index 2dcc5a1433b..3beb48f6e09 100644 --- a/mysql-test/main/merge.result +++ b/mysql-test/main/merge.result @@ -36,11 +36,11 @@ insert into t2 select NULL,message from t1; insert into t1 select NULL,message from t2; create table t3 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,test.t2); explain select * from t3 where a < 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range a a 4 NULL 17 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL range a a 4 NULL 17 Using where explain select * from t3 where a > 10 and a < 20; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range a a 4 NULL 17 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL range a a 4 NULL 17 Using where select * from t3 where a = 10; a b 10 Testing @@ -86,8 +86,8 @@ a b 19 Testing 19 Testing explain select a from t3 order by a desc limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index NULL a 4 NULL 10 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL index NULL a 4 NULL 10 Using index select a from t3 order by a desc limit 10; a 699 @@ -667,20 +667,20 @@ KEY files (fileset_id,fileset_root_id) ) ENGINE=MRG_MyISAM UNION=(t1); EXPLAIN SELECT * FROM t2 IGNORE INDEX (files) WHERE fileset_id = 2 AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY PRIMARY 35 NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 35 NULL 6 Using where EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2 AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY,files PRIMARY 35 NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range PRIMARY,files PRIMARY 35 NULL 6 Using where EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2 AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,files PRIMARY 35 NULL 6 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,files PRIMARY 35 NULL 6 Using index condition EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2 AND file_code = '0000000115' LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const PRIMARY,files PRIMARY 35 const,const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const PRIMARY,files PRIMARY 35 const,const 1 DROP TABLE t2, t1; create table t1 (x int, y int, index xy(x, y)); create table t2 (x int, y int, index xy(x, y)); @@ -740,8 +740,8 @@ engine=merge union=(t1 ,t2); insert into t1 (a,b,c) values (1,1,0),(1,2,0); insert into t2 (a,b,c) values (1,1,1),(1,2,1); explain select a,b,c from t3 force index (a) where a=1 order by a,b,c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ref a a 5 const 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ref a a 5 const 4 Using where; Using index select a,b,c from t3 force index (a) where a=1 order by a,b,c; a b c 1 1 0 @@ -749,8 +749,8 @@ a b c 1 2 0 1 2 1 explain select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ref a a 5 const 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ref a a 5 const 4 Using where; Using index select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc; a b c 1 2 1 @@ -2106,11 +2106,11 @@ INSERT INTO t1 VALUES (1,1), (1,2),(1,3), (1,4); INSERT INTO t2 VALUES (2,1), (2,2),(2,3), (2,4); INSERT INTO t3 VALUES (3,1), (3,2),(3,3), (3,4); EXPLAIN SELECT COUNT(*) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away EXPLAIN SELECT COUNT(*) FROM t4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away DROP TABLE t1, t2, t3, t4; CREATE TABLE t1(a INT, KEY(a)); INSERT INTO t1 VALUES(0),(1),(2),(3),(4); @@ -2367,8 +2367,8 @@ CREATE TABLE t2 (b INT NOT NULL,c INT,d INT,e BLOB NOT NULL, KEY idx0 (d, c)) ENGINE=MERGE; EXPLAIN SELECT * FROM t1 NATURAL RIGHT JOIN t2 WHERE b SOUNDS LIKE e AND d = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t2, t1; # # Bug#46339 - crash on REPAIR TABLE merge table USE_FRM @@ -2444,9 +2444,9 @@ alter table t5 union(t3, t4); update t5 set b=999, a=999 where b>950; explain select * from t2, t5 where t5.a=999 and t5.b=999; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t5 index_merge a,b a,b 5,5 NULL 6 Using intersect(a,b); Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t5 NULL index_merge a,b a,b 5,5 NULL 6 Using intersect(a,b); Using where; Using join buffer (flat, BNL join) select * from t2, t5 where t5.a=999 and t5.b=999; i a b filler 1 999 999 filler-data-FILLER-DATA-qqq diff --git a/mysql-test/main/mix2_myisam.result b/mysql-test/main/mix2_myisam.result index 5534511255d..071e1af9249 100644 --- a/mysql-test/main/mix2_myisam.result +++ b/mysql-test/main/mix2_myisam.result @@ -142,14 +142,14 @@ id parent_id level 1010 102 2 1015 102 2 explain select level from t1 where level=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref level level 1 const # Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref level level 1 const # Using index explain select level,id from t1 where level=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref level level 1 const # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref level level 1 const # explain select level,id,parent_id from t1 where level=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref level level 1 const # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref level level 1 const # select level,id from t1 where level=1; level id 1 1003 @@ -504,8 +504,8 @@ id parent_id level 1025 102 2 1016 102 2 explain select level from t1 where level=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref level level 1 const # Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref level level 1 const # Using index select level,id from t1 where level=1; level id 1 1004 @@ -671,8 +671,8 @@ DROP TABLE t1; create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = MyISAM; insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); explain select * from t1 where a > 0 and a < 50; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system PRIMARY NULL NULL NULL # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL # drop table t1; create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=MyISAM; insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); @@ -811,29 +811,29 @@ drop table t1; create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=MyISAM; insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); explain select * from t1 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # Using filesort explain select * from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # Using filesort explain select * from t1 order by c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # Using filesort explain select a from t1 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL # Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL # Using index explain select b from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 4 NULL # Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL b 4 NULL # Using index explain select a,b from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # Using filesort explain select a,b from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # explain select a,b,c from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # drop table t1; create table t1 (t int not null default 1, key (t)) engine=MyISAM; desc t1; @@ -1119,12 +1119,12 @@ select count(*) from t1; count(*) 29267 explain select * from t1 where c between 1 and 2500; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 5 NULL # Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c c 5 NULL # Using index condition update t1 set c=a; explain select * from t1 where c between 1 and 2500; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 5 NULL # Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c c 5 NULL # Using index condition drop table t1,t2; create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=MyISAM; insert into t1 (id) values (null),(null),(null),(null),(null); @@ -1364,8 +1364,8 @@ a b c d e 2 2 b 2 2 3 3 ab 3 3 explain select * from t1 order by a,b,c,d; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using filesort drop table t1; create table t1 (a char(1), b char(1), key(a, b)) engine=MyISAM; insert into t1 values ('8', '6'), ('4', '7'); @@ -1398,8 +1398,8 @@ select count(*) from t1 where x = -16; count(*) 0 explain select count(*) from t1 where x > -16; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 2 Using where; Using index select count(*) from t1 where x > -16; count(*) 2 @@ -1531,23 +1531,23 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index explain select count(*) from t1 where c='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c c 11 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref c c 11 const # Using where; Using index explain select count(*) from t1 where t='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref t t 13 const # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref t t 13 const # Using where explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 13 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 13 NULL # Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index alter table t1 add unique(v); ERROR 23000: Duplicate entry '{ ' for key 'v_2' show warnings; @@ -1569,8 +1569,8 @@ qq *a *a*a * *a *a*a * explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v,v_2 # 13 const # # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v,v_2 # 13 const # # select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1733,20 +1733,20 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 303 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 303 NULL # Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 303 const # # select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1813,20 +1813,20 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 33 const # Using where explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 33 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 33 NULL # Using where explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 33 const # Using where explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 33 const # Using where explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 33 const # # select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1982,8 +1982,8 @@ drop table t1; create table t1(a int, b varchar(12), key ba(b, a)); insert into t1 values (1, 'A'), (20, NULL); explain select * from t1 where a=20 and b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref ba ba 20 const,const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref ba ba 20 const,const 1 Using where; Using index select * from t1 where a=20 and b is null; a b 20 NULL diff --git a/mysql-test/main/mrr_derived_crash_4610.result b/mysql-test/main/mrr_derived_crash_4610.result index 3e38a0d4218..89c647faf0e 100644 --- a/mysql-test/main/mrr_derived_crash_4610.result +++ b/mysql-test/main/mrr_derived_crash_4610.result @@ -6,12 +6,12 @@ create table t4 (val int not null) engine=innodb charset=utf8; explain select 1 from (select f2, f3, val, count(id) from t4 join t2 left join t3 on 0) top join t1 on f1 = f3 where f3 = 'aaaa' order by val; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 const PRIMARY PRIMARY 12 const 1 Using index -1 PRIMARY <derived2> ref key0 key0 13 const 0 Using where; Using filesort -2 DERIVED t4 ALL NULL NULL NULL NULL 1 -2 DERIVED t2 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) -2 DERIVED t3 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL const PRIMARY PRIMARY 12 const 1 Using index +1 PRIMARY <derived2> NULL ref key0 key0 13 const 0 Using where; Using filesort +2 DERIVED t4 NULL ALL NULL NULL NULL NULL 1 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +2 DERIVED t3 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) select 1 from (select f2, f3, val, count(id) from t4 join t2 left join t3 on 0) top join t1 on f1 = f3 where f3 = 'aaaa' order by val; diff --git a/mysql-test/main/mrr_icp_extra.result b/mysql-test/main/mrr_icp_extra.result index a8c9bfc201a..6026c7699ae 100644 --- a/mysql-test/main/mrr_icp_extra.result +++ b/mysql-test/main/mrr_icp_extra.result @@ -19,35 +19,35 @@ INSERT INTO t1 VALUES ('h','h'); INSERT INTO t1 VALUES ('i','i'); INSERT INTO t1 VALUES ('j','j'); EXPLAIN SELECT * FROM t1 WHERE s1='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref s1 s1 11 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref s1 s1 11 const 1 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref s2 s2 11 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref s2 s2 11 const 1 Using index condition EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref s1 s1 11 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref s1 s1 11 const 1 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 Using where EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range s1 s1 11 NULL 2 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range s1 s1 11 NULL 2 Using index condition; Rowid-ordered scan EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 Using where EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range s1 s1 11 NULL 2 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range s1 s1 11 NULL 2 Using index condition; Rowid-ordered scan EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 Using where EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range s1 s1 11 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range s1 s1 11 NULL 1 Using index condition; Rowid-ordered scan EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 Using where DROP TABLE t1; # # @@ -60,8 +60,8 @@ EXPLAIN SELECT d FROM t1, t2 WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE' ORDER BY t2.c LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT d FROM t1, t2 WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE' ORDER BY t2.c LIMIT 1; @@ -73,8 +73,8 @@ create table t1(a int, b int, index(b)); insert into t1 values (2, 1), (1, 1), (4, NULL), (3, NULL), (6, 2), (5, 2); insert into t1 values (2, 11), (1, 11), (4, 14), (3, 14), (6, 12), (5, 12); explain select * from t1 where b=1 or b is null order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null b b 5 const 4 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null b b 5 const 4 Using index condition; Using filesort select * from t1 where b=1 or b is null order by a; a b 1 1 @@ -82,8 +82,8 @@ a b 3 NULL 4 NULL explain select * from t1 where b=2 or b is null order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null b b 5 const 4 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null b b 5 const 4 Using index condition; Using filesort select * from t1 where b=2 or b is null order by a; a b 3 NULL @@ -103,11 +103,11 @@ KEY StringField (FieldKey,StringVal(32)) ); INSERT INTO t1 VALUES ('0',3,'0'),('0',2,'1'),('0',1,'2'),('1',2,'1'),('1',1,'3'), ('1',0,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('3',2,'1'),('3',1,'2'),('3','3','3'); EXPLAIN SELECT * FROM t1 IGNORE INDEX (LongField, StringField) WHERE FieldKey > '2' ORDER BY LongVal; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range FieldKey FieldKey 38 NULL 3 Using index condition; Rowid-ordered scan; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range FieldKey FieldKey 38 NULL 3 Using index condition; Rowid-ordered scan; Using filesort EXPLAIN SELECT * FROM t1 IGNORE INDEX (FieldKey, LongField) WHERE FieldKey > '2' ORDER BY LongVal; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range StringField StringField 38 NULL 3 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range StringField StringField 38 NULL 3 Using where; Using filesort SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; FieldKey LongVal StringVal 3 1 2 @@ -124,8 +124,8 @@ optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status OK explain select * from t1 force index (a) where a=0 or a=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL 5 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 4 NULL 5 Using index condition; Rowid-ordered scan select * from t1 force index (a) where a=0 or a=2; a b c 0 NULL 0 @@ -161,8 +161,8 @@ key (pktail5bad, pk1, pk2, pk2copy), primary key (pk1, pk2) ); explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,key1 PRIMARY 8 NULL 7 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,key1 PRIMARY 8 NULL 7 Using index condition; Using where; Rowid-ordered scan select * from t1 where pk1 = 1 and pk2 < 80 and key1=0; pk1 pk2 key1 key2 pktail1ok pktail2ok pktail3bad pktail4bad pktail5bad pk2copy badkey filler1 filler2 1 19 0 0 0 0 0 0 0 19 0 filler-data-19 filler2 @@ -202,8 +202,8 @@ INSERT INTO t1 VALUES EXPLAIN SELECT * FROM t1 WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,f4 f4 35 NULL 5 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,f4 f4 35 NULL 5 Using index condition; Using where; Rowid-ordered scan SELECT * FROM t1 WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ; f1 f4 f5 @@ -332,23 +332,23 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index explain select count(*) from t1 where c='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c c 11 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref c c 11 const # Using where; Using index explain select count(*) from t1 where t='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref t t 13 const # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref t t 13 const # Using where explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 13 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 13 NULL # Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index alter table t1 add unique(v); ERROR 23000: Duplicate entry '{ ' for key 'v_2' show warnings; @@ -370,8 +370,8 @@ qq *a *a*a * *a *a*a * explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v,v_2 # 13 const # # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v,v_2 # 13 const # # select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -534,20 +534,20 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 303 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 303 NULL # Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 303 const # # select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -614,20 +614,20 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 33 const # Using where explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 33 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 33 NULL # Using where explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 33 const # Using where explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 33 const # Using where explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 33 const # # select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -783,8 +783,8 @@ drop table t1; create table t1(a int, b varchar(12), key ba(b, a)); insert into t1 values (1, 'A'), (20, NULL); explain select * from t1 where a=20 and b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref ba ba 20 const,const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref ba ba 20 const,const 1 Using where; Using index select * from t1 where a=20 and b is null; a b 20 NULL @@ -831,14 +831,14 @@ explain SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')) AND (Population > 101000 AND Population < 102000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Country Population 4 NULL # Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Country Population 4 NULL # Using index condition; Using where; Rowid-ordered scan explain SELECT * FROM City WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country Country,Population 3,4 NULL # Using sort_union(Country,Population); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country Country,Population 3,4 NULL # Using sort_union(Country,Population); Using where SELECT * FROM City WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000)); @@ -856,13 +856,13 @@ ID Name Country Population explain SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 7000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL # Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL # Using index condition; Using where; Rowid-ordered scan explain SELECT * FROM City WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Country # # NULL # Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Country # # NULL # Using index condition; Using where; Rowid-ordered scan SELECT * FROM City WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%'; ID Name Country Population @@ -881,8 +881,8 @@ ID Name Country Population explain SELECT * FROM City WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Country # # NULL # Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Country # # NULL # Using index condition; Using where; Rowid-ordered scan SELECT * FROM City WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%'; ID Name Country Population diff --git a/mysql-test/main/mrr_icp_extra.test b/mysql-test/main/mrr_icp_extra.test index c8c5e6b3af3..9bb1330ee7c 100644 --- a/mysql-test/main/mrr_icp_extra.test +++ b/mysql-test/main/mrr_icp_extra.test @@ -201,13 +201,13 @@ SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')) AND (Population > 101000 AND Population < 102000); ---replace_column 9 # +--replace_column 10 # explain SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')) AND (Population > 101000 AND Population < 102000); ---replace_column 9 # +--replace_column 10 # explain SELECT * FROM City WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR @@ -220,19 +220,19 @@ WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 7000000; ---replace_column 9 # +--replace_column 10 # explain SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 7000000; ---replace_column 6 # 7 # 9 # +--replace_column 7 # 8 # 10 # explain SELECT * FROM City WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%'; SELECT * FROM City WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%'; ---replace_column 6 # 7 # 9 # +--replace_column 7 # 8 # 10 # explain SELECT * FROM City WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%'; diff --git a/mysql-test/main/multi_update.result b/mysql-test/main/multi_update.result index 3ec9ea0caa5..1e494829a0b 100644 --- a/mysql-test/main/multi_update.result +++ b/mysql-test/main/multi_update.result @@ -1067,9 +1067,9 @@ insert t1 values (1),(2); create table t2 (f int) engine=myisam; insert t2 values (1),(2); explain update t1, t2 set f = 126 order by f limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 update t1, t2 set f = 126 order by f limit 2; select * from t2; f @@ -1091,10 +1091,10 @@ a b c a b c 4 4 4 4 4 4 set optimizer_switch='firstmatch=off'; explain update t1, t2 set t2.c=1 where t1.a=t2.a and t1.b in (select b from t3 where t3.c< t2.c) order by t2.c, t1.c limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary; Using filesort -1 PRIMARY t1 ref a a 5 test.t2.a 1 -1 PRIMARY t3 ALL NULL NULL NULL NULL 10 Using where; Start temporary; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 Using where; Using temporary; Using filesort +1 PRIMARY t1 NULL ref a a 5 test.t2.a 1 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 10 Using where; Start temporary; End temporary update t1, t2 set t2.c=1 where t1.a=t2.a and t1.b in (select b from t3 where t3.c<=t2.c) order by t2.c, t1.c limit 5; select * from t2; a b c @@ -1123,10 +1123,10 @@ x b c 0 1 0 0 2 0 explain update v1,t0 set c=1 where b=1 and x=c order by x,b limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t0 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 2 Using where update v1,t0 set c=1 where b<3 and x=c order by x,b limit 1; select * from v1; b c diff --git a/mysql-test/main/myisam.result b/mysql-test/main/myisam.result index 981131889e4..39d4ab7da64 100644 --- a/mysql-test/main/myisam.result +++ b/mysql-test/main/myisam.result @@ -53,29 +53,29 @@ drop table t1; create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=myisam; insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); explain select * from t1 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using filesort explain select * from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using filesort explain select * from t1 order by c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using filesort explain select a from t1 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 Using index explain select b from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 4 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL b 4 NULL 4 Using index explain select a,b from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using filesort explain select a,b from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 explain select a,b,c from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 drop table t1; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1), (2), (3); @@ -346,17 +346,17 @@ t1 1 a 2 b A 5 NULL NULL YES BTREE NO t1 1 c_2 1 c A 5 NULL NULL YES BTREE NO t1 1 c_2 2 a A 5 NULL NULL BTREE NO explain select * from t1,t2 where t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL a NULL NULL NULL 2 -1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 2 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) explain select * from t1,t2 force index(a) where t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL a NULL NULL NULL 2 -1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 2 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) explain select * from t1 force index(a),t2 force index(a) where t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL a NULL NULL NULL 2 -1 SIMPLE t1 ref a a 4 test.t2.a 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 2 +1 SIMPLE t1 NULL ref a a 4 test.t2.a 3 INSERT into t1 values (2,4,5), (7,8,4), (8,3,1), (9,7,2), (5,5,9); optimize table t1; Table Op Msg_type Msg_text @@ -370,9 +370,9 @@ t1 1 a 2 b A 10 NULL NULL YES BTREE NO t1 1 c_2 1 c A 10 NULL NULL YES BTREE NO t1 1 c_2 2 a A 10 NULL NULL BTREE NO explain select * from t1,t2 where t1.b=t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL b NULL NULL NULL 2 Using where -1 SIMPLE t1 ref b b 5 test.t2.b 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL b NULL NULL NULL 2 Using where +1 SIMPLE t1 NULL ref b b 5 test.t2.b 1 delete from t1 where t1.a>1; optimize table t1; Table Op Msg_type Msg_text @@ -386,21 +386,21 @@ t1 1 a 2 b A 5 NULL NULL YES BTREE NO t1 1 c_2 1 c A 5 NULL NULL YES BTREE NO t1 1 c_2 2 a A 5 NULL NULL BTREE NO explain select * from t1,t2 force index(c) where t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) explain select * from t1 where a=0 or a=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 5 Using where explain select * from t1 force index (a) where a=0 or a=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL 5 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 4 NULL 5 Using index condition explain select * from t1 where c=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c,c_2 c 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref c,c_2 c 5 const 1 explain select * from t1 use index() where c=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where drop table t1,t2; create table t1 (a int not null auto_increment primary key, b varchar(255)); insert into t1 (b) values (repeat('a',100)),(repeat('b',100)),(repeat('c',100)); @@ -523,13 +523,13 @@ select sql_big_result distinct t1.a from t1,t2; a 1 explain select sql_big_result distinct t1.a from t1,t2 order by t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary -1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 Using temporary +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 2 Using index explain select distinct t1.a from t1,t2 order by t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary -1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 Using temporary +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 2 Using index drop table t1,t2; create table t1 ( c1 varchar(32), @@ -639,8 +639,8 @@ drop table t1,t2; create table t1 ( a tinytext, b char(1), index idx (a(1),b) ); insert into t1 values (null,''), (null,''); explain select count(*) from t1 where a is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx idx 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx idx 4 const 2 Using where select count(*) from t1 where a is null; count(*) 2 @@ -1246,23 +1246,23 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index explain select count(*) from t1 where c='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c c 11 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref c c 11 const # Using where; Using index explain select count(*) from t1 where t='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref t t 13 const # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref t t 13 const # Using where explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 13 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 13 NULL # Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index alter table t1 add unique(v); ERROR 23000: Duplicate entry '{ ' for key 'v_2' show warnings; @@ -1284,8 +1284,8 @@ qq *a *a*a * *a *a*a * explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v,v_2 # 13 const # # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v,v_2 # 13 const # # select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1448,20 +1448,20 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 303 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 303 NULL # Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 303 const # # select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1528,20 +1528,20 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 33 const # Using where explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 33 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 33 NULL # Using where explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 33 const # Using where explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 33 const # Using where explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 33 const # # select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1697,8 +1697,8 @@ drop table t1; create table t1(a int, b varchar(12), key ba(b, a)); insert into t1 values (1, 'A'), (20, NULL); explain select * from t1 where a=20 and b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref ba ba 20 const,const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref ba ba 20 const,const 1 Using where; Using index select * from t1 where a=20 and b is null; a b 20 NULL diff --git a/mysql-test/main/myisam_explain_non_select_all.result b/mysql-test/main/myisam_explain_non_select_all.result index 2ff966fdfd3..872c9676bc7 100644 --- a/mysql-test/main/myisam_explain_non_select_all.result +++ b/mysql-test/main/myisam_explain_non_select_all.result @@ -10,21 +10,21 @@ INSERT INTO t1 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 SET a = 10 WHERE a < 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a < 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a < 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 10 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -53,21 +53,21 @@ INSERT INTO t1 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 WHERE a < 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a < 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a < 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 10 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -96,21 +96,21 @@ INSERT INTO t1 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 USING t1 WHERE a = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 USING t1 WHERE a = 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -141,24 +141,24 @@ INSERT INTO t2 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1, t2 SET t1.a = 10 WHERE t1.a = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1, t2 SET t1.a = 10 WHERE t1.a = 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE t1.a = 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -189,26 +189,26 @@ INSERT INTO t2 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 t11, (SELECT * FROM t2) t12 SET t11.a = 10 WHERE t11.a = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t11 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 -2 DERIVED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t11 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 t11, (SELECT * FROM t2) t12 SET t11.a = 10 WHERE t11.a = 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t11 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t11 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 t11, (SELECT * FROM t2) t12 WHERE t11.a = 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t11 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t11 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` where `test`.`t11`.`a` = 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -239,15 +239,15 @@ INSERT INTO t2 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -255,10 +255,10 @@ Handler_read_rnd_next 1 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` < 3 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -289,15 +289,15 @@ INSERT INTO t2 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT b FROM t2 WHERE t1.a < 3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT b FROM t2 WHERE t1.a < 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 # Status of EXPLAIN EXTENDED query @@ -306,9 +306,9 @@ Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (SELECT b FROM t2 WHERE t1.a < 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 @@ -340,30 +340,30 @@ INSERT INTO t2 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1, t2 SET a = 10 WHERE a IN (SELECT b FROM t2 WHERE t2.b < 3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1, t2 SET a = 10 WHERE a IN (SELECT b FROM t2 WHERE t2.b < 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a IN (SELECT b FROM t2 WHERE t2.b < 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` semi join (`test`.`t2`) join `test`.`t2` where `test`.`t2`.`b` < 3 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -394,26 +394,26 @@ INSERT INTO t2 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 t11, (SELECT * FROM t2) t12 SET t11.a = t11.a + 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t11 ALL NULL NULL NULL NULL 3 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 -2 DERIVED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t11 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 t11, (SELECT * FROM t2) t12 SET t11.a = t11.a + 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t11 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t11 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 t11, (SELECT * FROM t2) t12; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t11 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t11 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -446,17 +446,17 @@ INSERT INTO t2 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 t11, (SELECT 1 FROM DUAL) t12 SET t11.a = t11.a + 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 1 -1 PRIMARY t11 ALL NULL NULL NULL NULL 3 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 1 +1 PRIMARY t11 NULL ALL NULL NULL NULL NULL 3 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 t11, (SELECT 1 FROM DUAL) t12 SET t11.a = t11.a + 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t11 ALL NULL NULL NULL NULL 3 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t11 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -464,10 +464,10 @@ Handler_read_rnd_next 1 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 t11, (SELECT 1 FROM DUAL) t12; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t11 ALL NULL NULL NULL NULL 3 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t11 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t11`.`a` AS `a`,1 AS `1` from `test`.`t1` `t11` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -500,26 +500,26 @@ INSERT INTO t2 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 t11, (SELECT * FROM t2) t12 SET t11.a = 10 WHERE t11.a > 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t11 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 -2 DERIVED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t11 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 t11, (SELECT * FROM t2) t12 SET t11.a = 10 WHERE t11.a > 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t11 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t11 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 t11, (SELECT * FROM t2) t12 WHERE t11.a > 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t11 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t11 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` where `test`.`t11`.`a` > 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -548,21 +548,21 @@ INSERT INTO t1 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 WHERE a > 1 LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a > 1 LIMIT 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > 1 LIMIT 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1 limit 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -591,21 +591,21 @@ INSERT INTO t1 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 WHERE 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -631,21 +631,21 @@ INSERT INTO t1 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 USING t1 WHERE 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 USING t1 WHERE 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -671,21 +671,21 @@ INSERT INTO t1 VALUES (3, 3), (7, 7); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 WHERE a = 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 1 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a = 3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 5 NULL 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 1 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 5 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 const a a 5 const 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const a a 5 const 1 100.00 Warnings: Note 1003 select 3 AS `a`,3 AS `b` from `test`.`t1` where 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -712,21 +712,21 @@ INSERT INTO t1 VALUES (3, 3), (7, 7); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 WHERE a < 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 1 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a < 3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 5 NULL 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 1 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 5 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a < 3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 5 NULL 1 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 1 100.00 Using index condition Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` < 3 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -751,21 +751,21 @@ CREATE TABLE t1 ( a int PRIMARY KEY ); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE t1.a > 0 ORDER BY t1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select NULL AS `a` from `test`.`t1` where 0 order by NULL # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -790,21 +790,21 @@ INSERT INTO t1 VALUES (1), (2), (3), (-1), (-2), (-3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE t1.a > 0 ORDER BY t1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 0 order by `test`.`t1`.`a` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -833,21 +833,21 @@ INSERT INTO t1 VALUES (4),(3),(1),(2); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 WHERE (@a:= a) ORDER BY a LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 1 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE (@a:= a) ORDER BY a LIMIT 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 1 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE (@a:= a) ORDER BY a LIMIT 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 1 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where @a:=`test`.`t1`.`a` order by `test`.`t1`.`a` limit 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -877,21 +877,21 @@ UPDATE t1 SET a = c, b = c; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 ORDER BY a ASC, b ASC LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 ORDER BY a ASC, b ASC LIMIT 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 7 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 ORDER BY a ASC, b ASC LIMIT 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using filesort Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` order by `test`.`t1`.`a`,`test`.`t1`.`b` limit 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -930,27 +930,27 @@ INSERT INTO t3 VALUES (1,1), (2,1), (1,3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE t1,t2,t3 FROM t1,t2,t3 WHERE a1=a2 AND b2=a3 AND b1=b3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a1 1 +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE t1,t2,t3 FROM t1,t2,t3 WHERE a1=a2 AND b2=a3 AND b1=b3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 100.00 -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a1 1 100.00 +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 13 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1,t2,t3 WHERE a1=a2 AND b2=a3 AND b1=b3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 100.00 Using index -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a1 1 100.00 Using index +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1 100.00 Using index Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`b3` AS `b3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a2` = `test`.`t1`.`a1` and `test`.`t3`.`a3` = `test`.`t2`.`b2` and `test`.`t3`.`b3` = `test`.`t1`.`b1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -984,25 +984,25 @@ INSERT INTO t2 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (SELECT a FROM t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1034,24 +1034,24 @@ SET @save_optimizer_switch= @@optimizer_switch; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 5 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,<exists>(/* select#2 */ select `test`.`t2`.`a2` from `test`.`t2` where `test`.`t2`.`a2` > 2 and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`a2`))) # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1079,24 +1079,24 @@ INSERT INTO t1 VALUES (1), (2), (3), (4), (5); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 5 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`a2` > 2 and `test`.`t1`.`a1` = `test`.`t2`.`a2` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1125,21 +1125,21 @@ INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 SET i = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET i = 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1003 select `test`.`t1`.`i` AS `i`,`test`.`t1`.`j` AS `j` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1168,21 +1168,21 @@ INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL 5 Deleting all rows +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 5 Deleting all rows FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL 5 NULL Deleting all rows +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 5 NULL Deleting all rows # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1003 select `test`.`t1`.`i` AS `i`,`test`.`t1`.`j` AS `j` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1214,21 +1214,21 @@ INSERT INTO t2 (a, b, c) SELECT t1.i, t1.i, t1.i FROM t1, t1 x1, t1 x2; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 15 NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 5 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 5 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1260,21 +1260,21 @@ CREATE TABLE t2 (i INT); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN INSERT INTO t2 SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED INSERT INTO t2 SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1304,21 +1304,21 @@ CREATE TABLE t2 (i INT); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN REPLACE INTO t2 SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED REPLACE INTO t2 SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1344,13 +1344,13 @@ CREATE TABLE t1 (i INT); # select: # EXPLAIN INSERT INTO t1 SET i = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED INSERT INTO t1 SET i = 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 100.00 NULL # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -1367,13 +1367,13 @@ CREATE TABLE t1 (i INT); # select: # EXPLAIN REPLACE INTO t1 SET i = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED REPLACE INTO t1 SET i = 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 100.00 NULL # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 @@ -1395,21 +1395,21 @@ INSERT INTO t1 (i) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19), Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 5 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 5 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 8 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 8 100.00 Using index condition Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1440,21 +1440,21 @@ INSERT INTO t1 (i) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19), Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 26 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 26 Using where; Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL i NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL i NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1493,21 +1493,21 @@ INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 Using where; Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1547,21 +1547,21 @@ INSERT INTO t2 (a, b, c) SELECT t1.i, t1.i, t1.i FROM t1, t1 x1, t1 x2; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 15 NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 5 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 5 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1596,21 +1596,21 @@ INSERT INTO t2 SELECT i, i, i, i FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 Using where; Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1650,21 +1650,21 @@ INSERT INTO t2 SELECT i, i, i, i FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 Using where; Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1705,21 +1705,21 @@ INSERT INTO t2 (key1, key2) SELECT i, i FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index_merge key1,key2 key1,key2 5,5 NULL 7 Using sort_union(key1,key2); Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index_merge key1,key2 key1,key2 5,5 NULL 7 Using sort_union(key1,key2); Using where; Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort Warnings: Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`key1` AS `key1`,`test`.`t2`.`key2` AS `key2` from `test`.`t2` where `test`.`t2`.`key1` < 13 or `test`.`t2`.`key2` < 14 order by `test`.`t2`.`key1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1758,21 +1758,21 @@ INSERT INTO t2 (i) SELECT i FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 5 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 5 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1805,21 +1805,21 @@ INSERT INTO t2 SELECT i, i, i FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t2 ORDER BY a, b DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 ORDER BY a, b DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 ORDER BY a, b DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using filesort Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` order by `test`.`t2`.`a`,`test`.`t2`.`b` desc limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1859,21 +1859,21 @@ INSERT INTO t2 (a, b) SELECT t1.i, t1.i FROM t1, t1 x1, t1 x2; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t2 ORDER BY a DESC, b DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 6 NULL 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 6 NULL 5 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 ORDER BY a DESC, b DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index NULL a 6 NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 6 NULL 5 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 ORDER BY a DESC, b DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index NULL a 6 NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 6 NULL 5 100.00 Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` order by `test`.`t2`.`a` desc,`test`.`t2`.`b` desc limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1908,21 +1908,21 @@ INSERT INTO t2 (i) SELECT i FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 5 Using where; Using buffer FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using buffer # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 8 100.00 Using index condition Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -1956,21 +1956,21 @@ INSERT INTO t2 (i) SELECT i FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 Using where; Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL i NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL i NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2010,21 +2010,21 @@ INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 Using where; Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2065,21 +2065,21 @@ INSERT INTO t2 (a, b, c) SELECT t1.i, t1.i, t1.i FROM t1, t1 x1, t1 x2; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 15 NULL 5 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 5 Using where; Using buffer FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 5 100.00 Using where; Using buffer # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2115,21 +2115,21 @@ INSERT INTO t2 SELECT i, i, i, i FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 Using where; Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2169,21 +2169,21 @@ INSERT INTO t2 SELECT i, i, i, i FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 Using where; Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 8 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2224,21 +2224,21 @@ INSERT INTO t2 (key1, key2) SELECT i, i FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t2 SET i = 123 WHERE key1 < 13 or key2 < 14 ORDER BY key1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index_merge key1,key2 key1,key2 5,5 NULL 7 Using sort_union(key1,key2); Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index_merge key1,key2 key1,key2 5,5 NULL 7 Using sort_union(key1,key2); Using where; Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET i = 123 WHERE key1 < 13 or key2 < 14 ORDER BY key1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort Warnings: Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`key1` AS `key1`,`test`.`t2`.`key2` AS `key2` from `test`.`t2` where `test`.`t2`.`key1` < 13 or `test`.`t2`.`key2` < 14 order by `test`.`t2`.`key1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2277,21 +2277,21 @@ INSERT INTO t2 (i) SELECT i FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 5 Using where; Using buffer FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using buffer # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2325,21 +2325,21 @@ INSERT INTO t2 SELECT i, i, i FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 ORDER BY a, b DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 100.00 Using filesort Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` order by `test`.`t2`.`a`,`test`.`t2`.`b` desc limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2380,21 +2380,21 @@ INSERT INTO t2 (a, b) SELECT t1.i, t1.i FROM t1, t1 x1, t1 x2; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t2 SET c = 10 ORDER BY a DESC, b DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 6 NULL 5 Using buffer +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 6 NULL 5 Using buffer FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET c = 10 ORDER BY a DESC, b DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index NULL a 6 NULL 5 100.00 Using buffer +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 6 NULL 5 100.00 Using buffer # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 ORDER BY a DESC, b DESC LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index NULL a 6 NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 6 NULL 5 100.00 Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` order by `test`.`t2`.`a` desc,`test`.`t2`.`b` desc limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2432,21 +2432,21 @@ INSERT INTO t1 VALUES (1,'y',1), (2,'n',2), (3,'y',3), (4,'n',4); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c1_idx c1_idx 2 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c1_idx c1_idx 2 NULL 2 Using where; Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range c1_idx c1_idx 2 NULL 2 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c1_idx c1_idx 2 NULL 2 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref c1_idx c1_idx 2 const 2 100.00 Using index condition; Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c1_idx c1_idx 2 const 2 100.00 Using index condition; Using where; Using filesort Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1_idx` AS `c1_idx`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` where `test`.`t1`.`c1_idx` = 'y' order by `test`.`t1`.`pk` desc limit 2 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2478,21 +2478,21 @@ Sort_rows 2 Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c1_idx c1_idx 2 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range c1_idx c1_idx 2 NULL 2 Using where; Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range c1_idx c1_idx 2 NULL 2 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c1_idx c1_idx 2 NULL 2 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref c1_idx c1_idx 2 const 2 100.00 Using index condition; Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c1_idx c1_idx 2 const 2 100.00 Using index condition; Using where; Using filesort Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1_idx` AS `c1_idx`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` where `test`.`t1`.`c1_idx` = 'y' order by `test`.`t1`.`pk` desc limit 2 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2527,21 +2527,21 @@ INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),( Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 SET a=a+10 WHERE a > 34; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Using buffer FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a=a+10 WHERE a > 34; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using buffer # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > 34; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 34 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2572,15 +2572,15 @@ INSERT INTO t1 VALUES (1, 1, 10), (2, 2, 20); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 7 @@ -2588,9 +2588,9 @@ Handler_read_rnd_next 1 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2615,15 +2615,15 @@ Handler_read_rnd_next 4 Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 WHERE t1.c3 = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 WHERE t1.c3 = 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 7 @@ -2631,9 +2631,9 @@ Handler_read_rnd_next 1 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 WHERE t1.c3 = 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` where `test`.`t1`.`c3` = 10 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2665,15 +2665,15 @@ INSERT INTO t2 VALUES(1,1),(2,2); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 SET t1.f2=(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 ALL IDX NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY t2 NULL ALL IDX NULL NULL NULL 2 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET t1.f2=(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t2 ALL IDX NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL IDX NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1 # Status of EXPLAIN EXTENDED query @@ -2682,9 +2682,9 @@ Handler_read_key 7 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT (SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t2 ALL IDX NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL IDX NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select <expr_cache><`test`.`t1`.`f1`>((/* select#2 */ select max(`test`.`t2`.`f4`) from `test`.`t2` where `test`.`t2`.`f3` = `test`.`t1`.`f1`)) AS `(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1)` from `test`.`t1` @@ -2709,8 +2709,8 @@ CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (1); SET @a = NULL; EXPLAIN DELETE FROM t1 WHERE (@a:= a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 Using where DROP TABLE t1; #56 CREATE TABLE t1 (a INT); @@ -2738,24 +2738,24 @@ CREATE VIEW v1 AS SELECT t11.a, t12.a AS b FROM t1 t11, t1 t12; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE v1 SET a = 1 WHERE a > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t11 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t12 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t11 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t12 NULL ALL NULL NULL NULL NULL 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE v1 SET a = 1 WHERE a > 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t11 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t12 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t11 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t12 NULL ALL NULL NULL NULL NULL 2 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM v1 WHERE a > 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t11 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t12 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t11 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t12 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t12`.`a` AS `b` from `test`.`t1` `t11` join `test`.`t1` `t12` where `test`.`t11`.`a` > 0 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2781,27 +2781,27 @@ Handler_read_rnd_next 8 Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1, v1 SET v1.a = 1 WHERE t1.a = v1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t11 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t12 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t11 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t12 NULL ALL NULL NULL NULL NULL 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1, v1 SET v1.a = 1 WHERE t1.a = v1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t11 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t12 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t11 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t12 NULL ALL NULL NULL NULL NULL 2 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1, v1 WHERE t1.a = v1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t11 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t12 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t11 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t12 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t11`.`a` AS `a`,`test`.`t12`.`a` AS `b` from `test`.`t1` join `test`.`t1` `t11` join `test`.`t1` `t12` where `test`.`t11`.`a` = `test`.`t1`.`a` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2834,21 +2834,21 @@ CREATE VIEW v1 (a) AS SELECT a FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE FROM v1 WHERE a < 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 Using where FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM v1 WHERE a < 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM v1 WHERE a < 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 4 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2883,24 +2883,24 @@ CREATE VIEW v1 (a,c) AS SELECT a, b+1 FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE v1 FROM t2, v1 WHERE t2.x = v1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.x 1 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE v1 FROM t2, v1 WHERE t2.x = v1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2, v1 WHERE t2.x = v1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00 Warnings: Note 1003 select `test`.`t2`.`x` AS `x`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` + 1 AS `c` from `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`x` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2934,24 +2934,24 @@ CREATE VIEW v1 (a,c) AS SELECT a, b+1 FROM t1; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN DELETE v1 FROM t2, v1 WHERE t2.x = v1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.x 1 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE v1 FROM t2, v1 WHERE t2.x = v1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2, v1 WHERE t2.x = v1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00 Warnings: Note 1003 select `test`.`t2`.`x` AS `x`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` + 1 AS `c` from `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`x` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -2980,21 +2980,21 @@ CREATE VIEW v1 (x) AS SELECT a FROM t1; # select: SELECT NULL # EXPLAIN INSERT INTO v1 VALUES (10); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED INSERT INTO v1 VALUES (10); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 100.00 NULL # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select NULL AS `NULL` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -3020,13 +3020,13 @@ CREATE VIEW v1 (x) AS SELECT b FROM t2; Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN INSERT INTO v1 SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED INSERT INTO v1 SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 @@ -3034,8 +3034,8 @@ Handler_read_rnd_next 1 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -3058,8 +3058,8 @@ DROP VIEW v1; #68 CREATE TABLE t1 (i INT); EXPLAIN INSERT DELAYED INTO t1 VALUES (1); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL DROP TABLE t1; #69 CREATE TABLE t1 (a INT); @@ -3073,27 +3073,27 @@ INSERT INTO t2 VALUES (1), (2), (3); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 5 func 2 -3 DERIVED t2 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +2 DEPENDENT SUBQUERY <derived3> NULL index_subquery key0 key0 5 func 2 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 5 func 2 100.00 -3 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY <derived3> NULL index_subquery key0 key0 5 func 2 100.00 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <derived3> ref key0 key0 5 test.t1.a 2 100.00 FirstMatch(t1) -3 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t1.a 2 100.00 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join ((/* select#3 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`b` limit 2,2) `x`) where `x`.`b` = `test`.`t1`.`a` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -3124,30 +3124,30 @@ Sort_scan 1 Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1, t2 SET a = 10 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY <derived3> ref key0 key0 5 test.t1.a 2 FirstMatch(t1) -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -3 DERIVED t2 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t1.a 2 FirstMatch(t1) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1, t2 SET a = 10 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <derived3> ref key0 key0 5 test.t1.a 2 100.00 FirstMatch(t1) -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 -3 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t1.a 2 100.00 FirstMatch(t1) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <derived3> ref key0 key0 5 test.t1.a 2 100.00 FirstMatch(t1) -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -3 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t1.a 2 100.00 FirstMatch(t1) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` semi join ((/* select#3 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`b` limit 2,2) `x`) join `test`.`t2` where `x`.`b` = `test`.`t1`.`a` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -3177,32 +3177,32 @@ Sort_scan 1 Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1, (SELECT * FROM t2) y SET a = 10 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY <derived4> ref key0 key0 5 test.t1.a 2 FirstMatch(t1) -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 -4 DERIVED t2 ALL NULL NULL NULL NULL 3 Using filesort -2 DERIVED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 test.t1.a 2 FirstMatch(t1) +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 +4 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 Using filesort +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1, (SELECT * FROM t2) y SET a = 10 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <derived4> ref key0 key0 5 test.t1.a 2 100.00 FirstMatch(t1) -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00 -4 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort -2 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 test.t1.a 2 100.00 FirstMatch(t1) +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 100.00 +4 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1, (SELECT * FROM t2) y WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <derived4> ref key0 key0 5 test.t1.a 2 100.00 FirstMatch(t1) -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) -4 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 test.t1.a 2 100.00 FirstMatch(t1) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +4 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` semi join ((/* select#4 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`b` limit 2,2) `x`) join `test`.`t2` where `x`.`b` = `test`.`t1`.`a` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -3238,18 +3238,18 @@ STRAIGHT_JOIN t2 AS a21 ON a21.c2 = a11.c1 JOIN t1 AS a12 ON a12.c1 = a11.c1 ) d1 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 0 100.00 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 0 100.00 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t1, t2, t3; #73 CREATE TABLE t1 (id INT); CREATE TABLE t2 (id INT); INSERT INTO t1 VALUES (1), (2); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USING(id) GROUP BY t1.id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found; Using temporary; Using filesort -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 Const row not found; Using temporary; Using filesort +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 DROP TABLE t1,t2; #74 CREATE TABLE t1(a INT PRIMARY KEY); @@ -3262,21 +3262,21 @@ INSERT INTO t1 VALUES (1), (2), (3), (4), (5); Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 SET a=a+1 WHERE a>10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 1 Using where; Using buffer FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a=a+1 WHERE a>10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using buffer # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT a t1 FROM t1 WHERE a>10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `t1` from `test`.`t1` where `test`.`t1`.`a` > 10 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -3299,21 +3299,21 @@ Handler_read_key 4 Warnings: Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead EXPLAIN UPDATE t1 SET a=a+1 WHERE a>10 ORDER BY a+20; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 1 Using where; Using filesort FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a=a+1 WHERE a>10 ORDER BY a+20; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT a t1 FROM t1 WHERE a>10 ORDER BY a+20; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index; Using filesort Warnings: Note 1003 select `test`.`t1`.`a` AS `t1` from `test`.`t1` where `test`.`t1`.`a` > 10 order by `test`.`t1`.`a` + 20 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution @@ -3356,50 +3356,50 @@ CREATE PROCEDURE p16() BEGIN DELETE FROM t1 USING t1;END| CALL p16(); DROP PROCEDURE p16; CALL p15(); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found DROP PROCEDURE p15; CALL p14(); DROP PROCEDURE p14; CALL p13(); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL 0 Deleting all rows +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 0 Deleting all rows DROP PROCEDURE p13; CALL p12(); DROP PROCEDURE p12; CALL p11(); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP PROCEDURE p11; CALL p10(); DROP PROCEDURE p10; CALL p9(); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 0 DROP PROCEDURE p9; CALL p8(); DROP PROCEDURE p8; CALL p7(); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used DROP PROCEDURE p7; CALL p6(); DROP PROCEDURE p6; CALL p5(); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL DROP PROCEDURE p5; CALL p4(); DROP PROCEDURE p4; CALL p3(); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used DROP PROCEDURE p3; CALL p2(); DROP PROCEDURE p2; CALL p1(); -id select_type table type possible_keys key key_len ref rows Extra -1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL NULL DROP PROCEDURE p1; DROP TABLE t1, t2; # diff --git a/mysql-test/main/myisam_icp.result b/mysql-test/main/myisam_icp.result index d0614913480..dee8c97f2f8 100644 --- a/mysql-test/main/myisam_icp.result +++ b/mysql-test/main/myisam_icp.result @@ -164,8 +164,8 @@ FROM t1 WHERE ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00' ORDER BY ts DESC LIMIT 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 4 Using where DROP TABLE t1; # @@ -201,8 +201,8 @@ KEY (c1(6),i1) INSERT INTO t3 SELECT CONCAT('c-',1000+t2.a,'=w'), 1 FROM t2; EXPLAIN SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range c1 c1 8 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL range c1 c1 8 NULL 3 Using where SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w'; c1 c-1004=w @@ -210,14 +210,14 @@ c-1005=w c-1006=w EXPLAIN SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' and i1 > 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range c1 c1 12 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL range c1 c1 12 NULL 2 Using where SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' and i1 > 2; c1 EXPLAIN SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' or i1 > 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL c1 NULL NULL NULL 100 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL c1 NULL NULL NULL 100 Using where SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' or i1 > 2; c1 c-1004=w @@ -406,8 +406,8 @@ FROM t1 WHERE (pk BETWEEN 4 AND 5 OR pk < 2) AND c1 < 240 ORDER BY c1 LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range|filter PRIMARY,k1 PRIMARY|k1 4|5 NULL 3 (50%) Using index condition; Using where; Rowid-ordered scan; Using filesort; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range|filter PRIMARY,k1 PRIMARY|k1 4|5 NULL 3 (50%) Using index condition; Using where; Rowid-ordered scan; Using filesort; Using rowid filter DROP TABLE t1; # # @@ -427,10 +427,10 @@ set optimizer_switch='semijoin=off'; EXPLAIN SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL # Using where -2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func # Using index condition -2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL # Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL # Using where +2 DEPENDENT SUBQUERY it NULL eq_ref PRIMARY PRIMARY 4 func # Using index condition +2 DEPENDENT SUBQUERY t2 NULL index NULL PRIMARY 4 NULL # Using index; Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON it.i=it.i WHERE it.pk-t1.i<10); pk i @@ -449,8 +449,8 @@ PRIMARY KEY (pk) ); INSERT INTO t1 VALUES (1,9),(2,7),(3,6),(4,3),(5,1); EXPLAIN SELECT pk, c1 FROM t1 WHERE (pk<3 or pk>3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 5 Using where SET SESSION optimizer_switch='index_condition_pushdown=off'; SELECT pk, c1 FROM t1 WHERE (pk<3 or pk>3); pk c1 @@ -504,9 +504,9 @@ EXPLAIN SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1 WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR (t1.pk > 1 AND t2.pk BETWEEN 6 AND 6); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1 WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR (t1.pk > 1 AND t2.pk BETWEEN 6 AND 6); @@ -597,9 +597,9 @@ test.t2 analyze status OK EXPLAIN SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t2.pk <> t1.d1 AND t2.pk = 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL k1 9 NULL 3 Using index -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL k1 9 NULL 3 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 Using where SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t2.pk <> t1.d1 AND t2.pk = 4; d1 pk i1 @@ -607,9 +607,9 @@ d1 pk i1 EXPLAIN SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t1.d1 <> t2.pk AND t2.pk = 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL k1 9 NULL 3 Using index -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL k1 9 NULL 3 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 Using where SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t1.d1 <> t2.pk AND t2.pk = 4; d1 pk i1 @@ -650,8 +650,8 @@ EXPLAIN SELECT * FROM t1 WHERE NOT(b = 'Texas') AND b BETWEEN 'wy' AND 'y' OR b = 'Pennsylvania' ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range b b 13 NULL # Using where; Rowid-ordered scan; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range b b 13 NULL # Using where; Rowid-ordered scan; Using filesort SELECT * FROM t1 WHERE NOT(b = 'Texas') AND b BETWEEN 'wy' AND 'y' OR b = 'Pennsylvania' ORDER BY a; @@ -662,8 +662,8 @@ EXPLAIN SELECT * FROM t1 WHERE NOT(b = 'Texas') AND b BETWEEN 'wy' AND 'y' OR b = 'Pennsylvania' ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range b b 13 NULL # Using index condition; Rowid-ordered scan; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range b b 13 NULL # Using index condition; Rowid-ordered scan; Using filesort SELECT * FROM t1 WHERE NOT(b = 'Texas') AND b BETWEEN 'wy' AND 'y' OR b = 'Pennsylvania' ORDER BY a; @@ -684,9 +684,9 @@ SET SESSION optimizer_switch='index_condition_pushdown=off'; EXPLAIN SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND (t1.b<0 OR t1.b>0) HAVING t1.c != 5 ORDER BY t1.c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL # Using where; Using filesort -1 SIMPLE t2 ref a a 515 test.t1.a # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL # Using where; Using filesort +1 SIMPLE t2 NULL ref a a 515 test.t1.a # Using where SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND (t1.b<0 OR t1.b>0) HAVING t1.c != 5 ORDER BY t1.c; b c @@ -695,9 +695,9 @@ SET SESSION optimizer_switch='index_condition_pushdown=on'; EXPLAIN SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND (t1.b<0 OR t1.b>0) HAVING t1.c != 5 ORDER BY t1.c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL # Using where; Using filesort -1 SIMPLE t2 ref a a 515 test.t1.a # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL # Using where; Using filesort +1 SIMPLE t2 NULL ref a a 515 test.t1.a # Using where SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND (t1.b<0 OR t1.b>0) HAVING t1.c != 5 ORDER BY t1.c; b c @@ -814,11 +814,11 @@ SELECT COUNT(*) FROM t1 AS t, t2 WHERE c = g AND (EXISTS (SELECT * FROM t1, t2 WHERE a = f AND h <= t.e AND a > t.b) OR a = 0 AND h < 'z' ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t ALL PRIMARY,c NULL NULL NULL 64 Using where -1 PRIMARY t2 ref g g 5 test.t.c 18 Using where -2 DEPENDENT SUBQUERY t1 index PRIMARY PRIMARY 4 NULL 64 Using where; Using index -2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL ALL PRIMARY,c NULL NULL NULL 64 Using where +1 PRIMARY t2 NULL ref g g 5 test.t.c 18 Using where +2 DEPENDENT SUBQUERY t1 NULL index PRIMARY PRIMARY 4 NULL 64 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where SELECT COUNT(*) FROM t1 AS t, t2 WHERE c = g AND (EXISTS (SELECT * FROM t1, t2 WHERE a = f AND h <= t.e AND a > t.b) @@ -892,8 +892,8 @@ aa x a y EXPLAIN SELECT * FROM t1 FORCE INDEX(idx1) WHERE (c1='aa' AND c2='x') OR (c1='a' AND c2='y'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1 idx1 10 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1 idx1 10 NULL 2 Using where SELECT * FROM t1 FORCE INDEX(idx1) WHERE (c1='aa' AND c2='x') OR (c1='a' AND c2='y'); c1 c2 aa x @@ -926,16 +926,16 @@ INSERT INTO t1 VALUES (2,'x','x'), (5,'x','y'); SET SESSION optimizer_switch='index_condition_pushdown=off'; EXPLAIN SELECT a, MIN(c) FROM t1 WHERE b = 'x' AND c > 'x' GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx idx 4 const 2 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx idx 4 const 2 Using where; Using temporary; Using filesort SELECT a, MIN(c) FROM t1 WHERE b = 'x' AND c > 'x' GROUP BY a; a MIN(c) 5 y SET SESSION optimizer_switch='index_condition_pushdown=on'; EXPLAIN SELECT a, MIN(c) FROM t1 WHERE b = 'x' AND c > 'x' GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx idx 4 const 2 Using index condition; Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx idx 4 const 2 Using index condition; Using where; Using temporary; Using filesort SELECT a, MIN(c) FROM t1 WHERE b = 'x' AND c > 'x' GROUP BY a; a MIN(c) 5 y @@ -960,11 +960,11 @@ explain SELECT * FROM t1 LEFT JOIN t2 ON t1.c=t2.b WHERE t2.b NOT IN (SELECT t4.b FROM t3 STRAIGHT_JOIN t4 WHERE t4.b <= 2 AND t4.c = t3.c); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 -2 MATERIALIZED t4 range b b 5 NULL 1 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED t4 NULL range b b 5 NULL 1 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) SELECT * FROM t1 LEFT JOIN t2 ON t1.c=t2.b WHERE t2.b NOT IN (SELECT t4.b FROM t3 STRAIGHT_JOIN t4 WHERE t4.b <= 2 AND t4.c = t3.c); @@ -989,13 +989,13 @@ set @tmp_10000051= @@optimizer_switch; set optimizer_switch='mrr=off'; # Must not use ICP: explain select * from t1 where a between 5 and 8 order by a desc, col desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 40 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 40 Using where set optimizer_switch= @tmp_10000051; # Must not use ICP: explain select * from t1 where a=3 and col > 500 order by a desc, col desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 10 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 10 NULL 10 Using where drop table t0, t1; # # MDEV-13628: ORed condition in pushed index condition is not removed from the WHERE @@ -1008,8 +1008,8 @@ create table t1 (key1 int not null, filler char(100)); insert into t1 select A.a + 1000 *B.a, 'filler-data' from one_k A, ten B; alter table t1 add key(key1); explain select * from t1 where key1 < 3 or key1 > 99999; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range key1 key1 4 NULL 22 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range key1 key1 4 NULL 22 Using index condition; Rowid-ordered scan select * from t1 where key1 < 3 or key1 > 99999; key1 filler 0 filler-data diff --git a/mysql-test/main/myisam_icp_debug.result b/mysql-test/main/myisam_icp_debug.result index cb45a0e2274..08f578fcd50 100644 --- a/mysql-test/main/myisam_icp_debug.result +++ b/mysql-test/main/myisam_icp_debug.result @@ -16,8 +16,8 @@ engine MyISAM explain select * from t2 where kp1 between 10 and 20 and kp2 +1 >100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range kp1 kp1 5 NULL 11 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range kp1 kp1 5 NULL 11 Using index condition set debug_sync='handler_index_cond_check SIGNAL at_icp_check WAIT_FOR go'; select * from t2 where kp1 between 10 and 20 and kp2 +1 >100; connect con1, localhost, root,,; diff --git a/mysql-test/main/myisam_mrr.result b/mysql-test/main/myisam_mrr.result index 0cd2873c282..cc8ddae6386 100644 --- a/mysql-test/main/myisam_mrr.result +++ b/mysql-test/main/myisam_mrr.result @@ -188,8 +188,8 @@ select 'zz-1',NULL,'cc-2', 'filler-data' from t2 order by a limit 500; explain select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1' or c='no-such-row2'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 range idx1 idx1 29 NULL 10 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL range idx1 idx1 29 NULL 10 Using index condition; Rowid-ordered scan select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1' or c='no-such-row2'); a b c filler @@ -210,8 +210,8 @@ NULL NULL NULL NULL-2 NULL NULL NULL NULL-1 explain select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 range idx1 idx1 29 NULL 20 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL range idx1 idx1 29 NULL 20 Using index condition; Rowid-ordered scan select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); a b c filler b-1 NULL c-1 NULL-15 @@ -351,9 +351,9 @@ FROM t2 WHERE t2.int_key IS NULL GROUP BY t2.pk ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t2 ref int_key int_key 5 const 1 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t2 NULL ref int_key int_key 5 const 1 100.00 Using index condition Warnings: Note 1003 /* select#1 */ select min(`test`.`t1`.`pk`) AS `MIN(t1.pk)` from `test`.`t1` where 0 DROP TABLE t1, t2; @@ -367,8 +367,8 @@ insert into t1 select A.a + 10*(B.a + 10*C.a), 'bbb','filler' from t0 A, t0 B, t update t1 set b=repeat(char(65+a), 20) where a < 25; This must show range + using index condition: explain select * from t1 where a < 10 and b = repeat(char(65+a), 20); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 19 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 19 Using index condition; Using where select * from t1 where a < 10 and b = repeat(char(65+a), 20); a b filler 0 AAAAAAAAAAAAAAAAAAAA filler @@ -391,8 +391,8 @@ create table t1 (a int, b int, key(a)); insert into t1 select A.a + 10 *(B.a + 10*C.a), A.a + 10 *(B.a + 10*C.a) from t0 A, t0 B, t0 C; This mustn't show "Using MRR": explain select * from t1 where a < 20 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 20 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 20 Using index condition drop table t0, t1; # # Part of MWL#67: DS-MRR backport: add an @@optimizer_switch flag for @@ -407,17 +407,17 @@ create table t1 (a int, b int, key(a)); insert into t1 select A.a + 10 *(B.a + 10*C.a), A.a + 10 *(B.a + 10*C.a) from t0 A, t0 B, t0 C; A query that will use ICP: explain select * from t1 where a < 20; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 20 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 20 Using index condition; Rowid-ordered scan set @save_optimizer_switch=@@optimizer_switch; set optimizer_switch='index_condition_pushdown=off'; explain select * from t1 where a < 20; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 20 Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 20 Using where; Rowid-ordered scan set optimizer_switch='index_condition_pushdown=on'; explain select * from t1 where a < 20; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 20 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 20 Using index condition; Rowid-ordered scan set optimizer_switch=@save_optimizer_switch; # # BUG#629684: Unreachable code in multi_range_read.cc in maria-5.3-dsmrr-cpk @@ -429,9 +429,9 @@ set @save_join_cache_level=@@join_cache_level; set @@join_cache_level=6; explain select * from t0, t1 where t0.a<=>t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 5 -1 SIMPLE t1 ref a a 5 test.t0.a 1 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t1 NULL ref a a 5 test.t0.a 1 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan select * from t0, t1 where t0.a<=>t1.a; a a b 0 0 0 @@ -515,9 +515,9 @@ where table3.col_varchar_key = table2.col_varchar_key AND table3.col_varchar_key = table2.col_varchar_nokey AND table3.pk<>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE table2 ALL col_varchar_key NULL NULL NULL 40 Using where -1 SIMPLE table3 ref PRIMARY,col_varchar_key col_varchar_key 3 test.table2.col_varchar_key 5 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE table2 NULL ALL col_varchar_key NULL NULL NULL 40 Using where +1 SIMPLE table3 NULL ref PRIMARY,col_varchar_key col_varchar_key 3 test.table2.col_varchar_key 5 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan set join_cache_level= @save_join_cache_level; set join_buffer_size= @save_join_buffer_size; drop table t1; @@ -543,10 +543,10 @@ t1 AS alias2 FORCE KEY (f4) WHERE alias2.f4=alias3.f5 AND alias2.f3 > alias3.f1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL f4 10 NULL 12 Using index -1 SIMPLE alias3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) -1 SIMPLE alias2 ref f4 f4 5 test.alias3.f5 2 Using index condition(BKA); Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL f4 10 NULL 12 Using index +1 SIMPLE alias3 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +1 SIMPLE alias2 NULL ref f4 f4 5 test.alias3.f5 2 Using index condition(BKA); Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT COUNT(alias2.f2) FROM t1 STRAIGHT_JOIN @@ -575,8 +575,8 @@ create table t1 (a int, b int, filler char(200), key(a)); insert into t1 select A.a+10*B.a+100*C.a+1000*D.a, 123,'filler' from t0 A, t0 B, t0 C, t0 D; explain select sum(b) from t1 where a < 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 9 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 9 Using index condition; Rowid-ordered scan # This should show one MRR scan and no re-fills: flush status; select sum(b) from t1 where a < 10; @@ -590,8 +590,8 @@ Handler_mrr_rowid_refills 0 set @mrr_buffer_size_save= @@mrr_buffer_size; set mrr_buffer_size=128; explain select sum(b) from t1 where a < 1600; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1380 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 1380 Using index condition; Rowid-ordered scan # This should show one MRR scan and one extra rowid sort: flush status; select sum(b) from t1 where a < 1600; @@ -608,9 +608,9 @@ set @join_cache_level_save= @@join_cache_level; set @join_buffer_size_save= @@join_buffer_size; set join_cache_level=6; explain select sum(t1.b) from t0,t1 where t0.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 ref a a 5 test.t0.a 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 NULL ref a a 5 test.t0.a 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan flush status; select sum(t1.b) from t0,t1 where t0.a=t1.a; sum(t1.b) @@ -622,9 +622,9 @@ Handler_mrr_key_refills 1 Handler_mrr_rowid_refills 1 set join_buffer_size=10; explain select sum(t1.b) from t0,t1 where t0.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 ref a a 5 test.t0.a 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE t1 NULL ref a a 5 test.t0.a 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan flush status; select sum(t1.b) from t0,t1 where t0.a=t1.a; sum(t1.b) diff --git a/mysql-test/main/myisam_optimize.result b/mysql-test/main/myisam_optimize.result index cf54e52610b..fdd8a427230 100644 --- a/mysql-test/main/myisam_optimize.result +++ b/mysql-test/main/myisam_optimize.result @@ -5,8 +5,8 @@ insert t1 (b) select repeat("B", 200) from t1; insert t1 (b) select repeat("C", 300) from t1; delete from t1 where a < 3; explain select a, left(b,10) from t1 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using filesort select left(b,10), a from t1 order by a; left(b,10) a CCCCCCCCCC 3 diff --git a/mysql-test/main/mysql_client_test.result b/mysql-test/main/mysql_client_test.result index dbc1feaa23b..72c703ba9a8 100644 --- a/mysql-test/main/mysql_client_test.result +++ b/mysql-test/main/mysql_client_test.result @@ -137,120 +137,128 @@ def MAX(a) MAX(a) 3 11 0 Y 32768 0 63 # cat MYSQL_TMP_DIR/test_explain_meta.out.log # ------------------------------------ SELECT number of fields: 1 -EXPALIN number of fields: 10 +EXPALIN number of fields: 11 - 0: name: 'id'/''; table: ''/''; db: ''; catalog: 'def'; length: 3; max_length: 0; type: 8; decimals: 0 - 1: name: 'select_type'/''; table: ''/''; db: ''; catalog: 'def'; length: 57; max_length: 0; type: 253; decimals: 39 - 2: name: 'table'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 3: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 - - 4: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 5: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 - - 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 9: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 + - 3: name: 'partitions'/''; table: ''/''; db: ''; catalog: 'def'; length: 18948096; max_length: 0; type: 250; decimals: 39 + - 4: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 + - 5: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 6: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 7: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 8: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 + - 9: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 10: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 EXPALIN JSON number of fields: 1 - 0: name: 'EXPLAIN'/''; table: ''/''; db: ''; catalog: 'def'; length: 234; max_length: 0; type: 253; decimals: 39 -ANALYZE number of fields: 13 +ANALYZE number of fields: 14 - 0: name: 'id'/''; table: ''/''; db: ''; catalog: 'def'; length: 3; max_length: 0; type: 8; decimals: 0 - 1: name: 'select_type'/''; table: ''/''; db: ''; catalog: 'def'; length: 57; max_length: 0; type: 253; decimals: 39 - 2: name: 'table'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 3: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 - - 4: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 5: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 - - 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 10: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - - 11: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - - 12: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 + - 3: name: 'partitions'/''; table: ''/''; db: ''; catalog: 'def'; length: 18948096; max_length: 0; type: 250; decimals: 39 + - 4: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 + - 5: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 6: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 7: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 8: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 + - 9: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 10: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 11: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 + - 12: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 + - 13: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 ANALYZE JSON number of fields: 1 - 0: name: 'ANALYZE'/''; table: ''/''; db: ''; catalog: 'def'; length: 234; max_length: 0; type: 253; decimals: 39 -EXPALIN INSERT number of fields: 10 +EXPALIN INSERT number of fields: 11 - 0: name: 'id'/''; table: ''/''; db: ''; catalog: 'def'; length: 3; max_length: 0; type: 8; decimals: 0 - 1: name: 'select_type'/''; table: ''/''; db: ''; catalog: 'def'; length: 57; max_length: 0; type: 253; decimals: 39 - 2: name: 'table'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 3: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 - - 4: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 5: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 - - 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 9: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 + - 3: name: 'partitions'/''; table: ''/''; db: ''; catalog: 'def'; length: 18948096; max_length: 0; type: 250; decimals: 39 + - 4: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 + - 5: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 6: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 7: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 8: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 + - 9: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 10: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 EXPALIN JSON INSERT number of fields: 1 - 0: name: 'EXPLAIN'/''; table: ''/''; db: ''; catalog: 'def'; length: 234; max_length: 0; type: 253; decimals: 39 -ANALYZE INSERT number of fields: 13 +ANALYZE INSERT number of fields: 14 - 0: name: 'id'/''; table: ''/''; db: ''; catalog: 'def'; length: 3; max_length: 0; type: 8; decimals: 0 - 1: name: 'select_type'/''; table: ''/''; db: ''; catalog: 'def'; length: 57; max_length: 0; type: 253; decimals: 39 - 2: name: 'table'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 3: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 - - 4: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 5: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 - - 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 10: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - - 11: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - - 12: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 + - 3: name: 'partitions'/''; table: ''/''; db: ''; catalog: 'def'; length: 18948096; max_length: 0; type: 250; decimals: 39 + - 4: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 + - 5: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 6: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 7: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 8: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 + - 9: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 10: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 11: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 + - 12: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 + - 13: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 ANALYZE JSON INSERT number of fields: 1 - 0: name: 'ANALYZE'/''; table: ''/''; db: ''; catalog: 'def'; length: 234; max_length: 0; type: 253; decimals: 39 -EXPALIN UPDATE number of fields: 10 +EXPALIN UPDATE number of fields: 11 - 0: name: 'id'/''; table: ''/''; db: ''; catalog: 'def'; length: 3; max_length: 0; type: 8; decimals: 0 - 1: name: 'select_type'/''; table: ''/''; db: ''; catalog: 'def'; length: 57; max_length: 0; type: 253; decimals: 39 - 2: name: 'table'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 3: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 - - 4: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 5: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 - - 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 9: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 + - 3: name: 'partitions'/''; table: ''/''; db: ''; catalog: 'def'; length: 18948096; max_length: 0; type: 250; decimals: 39 + - 4: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 + - 5: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 6: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 7: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 8: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 + - 9: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 10: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 EXPALIN JSON UPDATE number of fields: 1 - 0: name: 'EXPLAIN'/''; table: ''/''; db: ''; catalog: 'def'; length: 234; max_length: 0; type: 253; decimals: 39 -ANALYZE UPDATE number of fields: 13 +ANALYZE UPDATE number of fields: 14 - 0: name: 'id'/''; table: ''/''; db: ''; catalog: 'def'; length: 3; max_length: 0; type: 8; decimals: 0 - 1: name: 'select_type'/''; table: ''/''; db: ''; catalog: 'def'; length: 57; max_length: 0; type: 253; decimals: 39 - 2: name: 'table'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 3: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 - - 4: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 5: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 - - 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 10: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - - 11: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - - 12: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 + - 3: name: 'partitions'/''; table: ''/''; db: ''; catalog: 'def'; length: 18948096; max_length: 0; type: 250; decimals: 39 + - 4: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 + - 5: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 6: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 7: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 8: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 + - 9: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 10: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 11: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 + - 12: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 + - 13: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 ANALYZE JSON UPDATE number of fields: 1 - 0: name: 'ANALYZE'/''; table: ''/''; db: ''; catalog: 'def'; length: 234; max_length: 0; type: 253; decimals: 39 -EXPALIN DELETE number of fields: 10 +EXPALIN DELETE number of fields: 11 - 0: name: 'id'/''; table: ''/''; db: ''; catalog: 'def'; length: 3; max_length: 0; type: 8; decimals: 0 - 1: name: 'select_type'/''; table: ''/''; db: ''; catalog: 'def'; length: 57; max_length: 0; type: 253; decimals: 39 - 2: name: 'table'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 3: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 - - 4: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 5: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 - - 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 9: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 + - 3: name: 'partitions'/''; table: ''/''; db: ''; catalog: 'def'; length: 18948096; max_length: 0; type: 250; decimals: 39 + - 4: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 + - 5: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 6: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 7: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 8: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 + - 9: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 10: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 EXPALIN JSON DELETE number of fields: 1 - 0: name: 'EXPLAIN'/''; table: ''/''; db: ''; catalog: 'def'; length: 234; max_length: 0; type: 253; decimals: 39 -ANALYZE DELETE number of fields: 13 +ANALYZE DELETE number of fields: 14 - 0: name: 'id'/''; table: ''/''; db: ''; catalog: 'def'; length: 3; max_length: 0; type: 8; decimals: 0 - 1: name: 'select_type'/''; table: ''/''; db: ''; catalog: 'def'; length: 57; max_length: 0; type: 253; decimals: 39 - 2: name: 'table'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 3: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 - - 4: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 5: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 6: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 - - 7: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 - - 8: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 9: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 - - 10: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - - 11: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 - - 12: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 + - 3: name: 'partitions'/''; table: ''/''; db: ''; catalog: 'def'; length: 18948096; max_length: 0; type: 250; decimals: 39 + - 4: name: 'type'/''; table: ''/''; db: ''; catalog: 'def'; length: 30; max_length: 0; type: 253; decimals: 39 + - 5: name: 'possible_keys'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 6: name: 'key'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 7: name: 'key_len'/''; table: ''/''; db: ''; catalog: 'def'; length: 12288; max_length: 0; type: 253; decimals: 39 + - 8: name: 'ref'/''; table: ''/''; db: ''; catalog: 'def'; length: 6144; max_length: 0; type: 253; decimals: 39 + - 9: name: 'rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 10: name: 'r_rows'/''; table: ''/''; db: ''; catalog: 'def'; length: 192; max_length: 0; type: 253; decimals: 39 + - 11: name: 'filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 + - 12: name: 'r_filtered'/''; table: ''/''; db: ''; catalog: 'def'; length: 4; max_length: 0; type: 5; decimals: 2 + - 13: name: 'Extra'/''; table: ''/''; db: ''; catalog: 'def'; length: 765; max_length: 0; type: 253; decimals: 39 ANALYZE JSON DELETE number of fields: 1 - 0: name: 'ANALYZE'/''; table: ''/''; db: ''; catalog: 'def'; length: 234; max_length: 0; type: 253; decimals: 39 # ------------------------------------ diff --git a/mysql-test/main/negation_elimination.result b/mysql-test/main/negation_elimination.result index 7b9a76d86b2..ef1f6958022 100644 --- a/mysql-test/main/negation_elimination.result +++ b/mysql-test/main/negation_elimination.result @@ -3,8 +3,8 @@ create table t1 (a int, key (a)); insert into t1 values (NULL), (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12), (13), (14), (15), (16), (17), (18), (19); explain select * from t1 where not(not(a)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 20 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 20 Using where; Using index select * from t1 where not(not(a)); a 1 @@ -27,8 +27,8 @@ a 18 19 explain select * from t1 where not(not(not(a > 10))); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 11 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 11 Using where; Using index select * from t1 where not(not(not(a > 10))); a 0 @@ -43,8 +43,8 @@ a 9 10 explain select * from t1 where not(not(not(a < 5) and not(a > 10))); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 6 Using where; Using index select * from t1 where not(not(not(a < 5) and not(a > 10))); a 5 @@ -54,8 +54,8 @@ a 9 10 explain select * from t1 where not(a = 10); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 19 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 19 Using where; Using index select * from t1 where not(a = 10); a 0 @@ -78,14 +78,14 @@ a 18 19 explain select * from t1 where not(a != 10); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 5 const 1 Using index select * from t1 where not(a != 1); a 1 explain select * from t1 where not(a < 10); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 Using where; Using index select * from t1 where not(a < 10); a 10 @@ -99,8 +99,8 @@ a 18 19 explain select * from t1 where not(a >= 10); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 Using where; Using index select * from t1 where not(a >= 10); a 0 @@ -114,8 +114,8 @@ a 8 9 explain select * from t1 where not(a > 10); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 11 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 11 Using where; Using index select * from t1 where not(a > 10); a 0 @@ -130,8 +130,8 @@ a 9 10 explain select * from t1 where not(a <= 10); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 9 Using where; Using index select * from t1 where not(a <= 10); a 11 @@ -144,8 +144,8 @@ a 18 19 explain select * from t1 where not(a is null); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 20 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 20 Using where; Using index select * from t1 where not(a is null); a 0 @@ -169,14 +169,14 @@ a 18 19 explain select * from t1 where not(a is not null); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 5 const 1 Using where; Using index select * from t1 where not(a is not null); a NULL explain select * from t1 where not(a < 5 or a > 15); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 11 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 11 Using where; Using index select * from t1 where not(a < 5 or a > 15); a 5 @@ -191,8 +191,8 @@ a 14 15 explain select * from t1 where not(a < 15 and a > 5); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 11 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 11 Using where; Using index select * from t1 where not(a < 15 and a > 5); a 0 @@ -207,8 +207,8 @@ a 18 19 explain select * from t1 where a = 2 or not(a < 10); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 11 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 11 Using where; Using index select * from t1 where a = 2 or not(a < 10); a 2 @@ -223,8 +223,8 @@ a 18 19 explain select * from t1 where a > 5 and not(a > 10); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 5 Using where; Using index select * from t1 where a > 5 and not(a > 10); a 6 @@ -233,8 +233,8 @@ a 9 10 explain select * from t1 where a > 5 xor a < 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 21 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 21 Using where; Using index select * from t1 where a > 5 xor a < 10; a 0 @@ -254,8 +254,8 @@ a 18 19 explain select * from t1 where a = 2 or not(a < 5 or a > 15); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 12 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 12 Using where; Using index select * from t1 where a = 2 or not(a < 5 or a > 15); a 2 @@ -271,8 +271,8 @@ a 14 15 explain select * from t1 where a = 7 or not(a < 15 and a > 5); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 12 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 12 Using where; Using index select * from t1 where a = 7 or not(a < 15 and a > 5); a 0 @@ -288,8 +288,8 @@ a 18 19 explain select * from t1 where NULL or not(a < 15 and a > 5); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 11 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 11 Using where; Using index select * from t1 where NULL or not(a < 15 and a > 5); a 0 @@ -304,8 +304,8 @@ a 18 19 explain select * from t1 where not(NULL and a > 5); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 6 Using where; Using index select * from t1 where not(NULL and a > 5); a 0 @@ -315,19 +315,19 @@ a 4 5 explain select * from t1 where not(NULL or a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE select * from t1 where not(NULL or a); a explain select * from t1 where not(NULL and a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 5 const 1 Using index select * from t1 where not(NULL and a); a 0 explain select * from t1 where not((a < 5 or a < 10) and (not(a > 16) or a > 17)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 Using where; Using index select * from t1 where not((a < 5 or a < 10) and (not(a > 16) or a > 17)); a 10 @@ -341,8 +341,8 @@ a 18 19 explain select * from t1 where not((a < 5 and a < 10) and (not(a > 16) or a > 17)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 15 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 15 Using where; Using index select * from t1 where not((a < 5 and a < 10) and (not(a > 16) or a > 17)); a 5 @@ -361,8 +361,8 @@ a 18 19 explain select * from t1 where ((a between 5 and 15) and (not(a like 10))); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 11 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 11 Using where; Using index select * from t1 where ((a between 5 and 15) and (not(a like 10))); a 5 @@ -479,14 +479,14 @@ SELECT * FROM t1 WHERE NOT (NULL XOR (a > 7)); a # Should be simplified to "...WHERE (a XOR a) EXPLAIN EXTENDED SELECT * FROM t1 WHERE NOT ((NOT a) XOR (a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL a 5 NULL 21 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 21 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` xor `test`.`t1`.`a` # Should be simplified to "...WHERE (a XOR a) EXPLAIN EXTENDED SELECT * FROM t1 WHERE NOT (a XOR (NOT a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL a 5 NULL 21 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 21 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` xor `test`.`t1`.`a` # End XOR @@ -499,8 +499,8 @@ NULL NULL 2 1 3 1 explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like "1"), not (a not in (1,2)), not(a != 2) from t1 where not(not(a)) having not(not(a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 5 NULL 4 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 4 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a` <> 0 AS `not(not(a))`,`test`.`t1`.`a` > 2 or `test`.`t1`.`a` <> 0 AS `not(a <= 2 and not(a))`,`test`.`t1`.`a` like '1' AS `not(a not like "1")`,`test`.`t1`.`a` in (1,2) AS `not (a not in (1,2))`,`test`.`t1`.`a` = 2 AS `not(a != 2)` from `test`.`t1` where `test`.`t1`.`a` <> 0 having `test`.`t1`.`a` <> 0 drop table t1; diff --git a/mysql-test/main/null.result b/mysql-test/main/null.result index 16a51d2d931..e0baedf57f4 100644 --- a/mysql-test/main/null.result +++ b/mysql-test/main/null.result @@ -7,8 +7,8 @@ Warning 1365 Division by 0 Warning 1365 Division by 0 Warning 1365 Division by 0 explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select NULL AS `NULL`,NULL AS `NULL`,NULL is null AS `isnull(null)`,1 / 0 is null AS `isnull(1/0)`,1 / 0 = NULL is null AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,'TRUE') AS `ifnull(null,"TRUE")`,ifnull('TRUE','ERROR') AS `ifnull("TRUE","ERROR")`,1 / 0 is null AS `1/0 is null`,1 is not null AS `1 is not null` select 1 | NULL,1 & NULL,1+NULL,1-NULL; @@ -33,8 +33,8 @@ select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between 2 between null and 1 2 between 3 AND NULL NULL between 1 and 2 2 between NULL and 3 2 between 1 AND null 0 0 NULL NULL NULL explain extended select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 2 between NULL and 1 AS `2 between null and 1`,2 between 3 and NULL AS `2 between 3 AND NULL`,NULL between 1 and 2 AS `NULL between 1 and 2`,2 between NULL and 3 AS `2 between NULL and 3`,2 between 1 and NULL AS `2 between 1 AND null` SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0; @@ -50,8 +50,8 @@ select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226." inet_ntoa(null) inet_aton(null) inet_aton("122.256") inet_aton("122.226.") inet_aton("") NULL NULL NULL NULL NULL explain extended select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton(""); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select inet_ntoa(NULL) AS `inet_ntoa(null)`,inet_aton(NULL) AS `inet_aton(null)`,inet_aton('122.256') AS `inet_aton("122.256")`,inet_aton('122.226.') AS `inet_aton("122.226.")`,inet_aton('') AS `inet_aton("")` select not null is true, not null or true, not null and false, not null <=> null; @@ -154,11 +154,11 @@ insert into t1 values (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9), (10,10), (11,11), (12,12); explain select * from t1 where a between 2 and 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 4 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 4 NULL 2 Using index condition explain select * from t1 where a between 2 and 3 or b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 4 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 4 NULL 2 Using index condition drop table t1; select cast(NULL as signed); cast(NULL as signed) @@ -176,8 +176,8 @@ insert into t1 select i*2 from t1; insert into t1 select i*2 from t1; insert into t1 values(null); explain select * from t1 where i=2 or i is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null i i 5 const 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null i i 5 const 9 Using where; Using index select count(*) from t1 where i=2 or i is null; count(*) 10 @@ -186,8 +186,8 @@ alter table t1 change i i int not null; Warnings: Warning 1265 Data truncated for column 'i' at row 513 explain select * from t1 where i=2 or i is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref i i 4 const 8 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref i i 4 const 8 Using index select count(*) from t1 where i=2 or i is null; count(*) 9 @@ -358,8 +358,8 @@ CREATE TABLE t1 (dt DATETIME NOT NULL); INSERT INTO t1 VALUES (NOW()),(NOW()); EXPLAIN SELECT * FROM t1 WHERE concat( dt, '2012-12-21 12:12:12' ) IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE concat( dt, '2012-12-21 12:12:12' ) IS NULL; dt DROP TABLE t1; @@ -367,8 +367,8 @@ CREATE TABLE t1 (dt INT NOT NULL); INSERT INTO t1 VALUES (1),(2); EXPLAIN SELECT * FROM t1 WHERE concat( dt, '1' ) IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE concat( dt, '1' ) IS NULL; dt DROP TABLE t1; @@ -376,8 +376,8 @@ CREATE TABLE t1 (dt INT NOT NULL); INSERT INTO t1 VALUES (1),(2); EXPLAIN SELECT * FROM t1 WHERE NOT (concat( dt, '1' ) IS NOT NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE NOT (concat( dt, '1' ) IS NOT NULL); dt DROP TABLE t1; @@ -1619,16 +1619,16 @@ SELECT * FROM t1 WHERE a=2010 AND NULLIF(10.1,a) IS NULL; a 2010 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND NULLIF(10.1,a) IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 SELECT * FROM t1 WHERE a=2010 AND CASE WHEN 10.1=a THEN NULL ELSE 10.1 END IS NULL; a 2010 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND CASE WHEN 10.1=a THEN NULL ELSE 10.1 END IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 DROP TABLE t1; @@ -1657,8 +1657,8 @@ CHARSET(NULLIF(a,_utf8'a' COLLATE utf8_bin)) latin1 latin1 EXPLAIN EXTENDED SELECT NULLIF(a,_utf8'a' COLLATE utf8_bin) IS NULL AS expr FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 select (case when convert(`test`.`t1`.`a` using utf8mb3) = _utf8mb3'a' collate utf8mb3_bin then NULL else `test`.`t1`.`a` end) is null AS `expr` from `test`.`t1` DROP TABLE t1; @@ -1680,14 +1680,14 @@ SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)='2011'; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)='2011'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 and (case when 2010 = 2011 then NULL else `test`.`t1`.`a` end) = '2011' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)=CONCAT('2011',RAND()); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 and (case when 2010 = 2011 then NULL else `test`.`t1`.`a` end) = concat('2011',rand()) DROP TABLE t1; @@ -1707,14 +1707,14 @@ a 2020 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)='2020'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2020 and (case when 2020 = 2010 then NULL else `test`.`t1`.`a` end) = '2020' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)=CONCAT('2020',RAND()); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2020 and (case when 2020 = 2010 then NULL else `test`.`t1`.`a` end) = concat('2020',rand()) DROP TABLE t1; @@ -1768,13 +1768,13 @@ SELECT @a; @a 3 EXPLAIN EXTENDED SELECT NULLIF(a,0) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select nullif(`test`.`t1`.`a`,0) AS `NULLIF(a,0)` from `test`.`t1` EXPLAIN EXTENDED SELECT NULLIF(AVG(a),0) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select nullif(<cache>(avg(`test`.`t1`.`a`)),0) AS `NULLIF(AVG(a),0)` from `test`.`t1` DROP TABLE t1; @@ -1849,8 +1849,8 @@ CREATE TABLE t1 (c1 INT); INSERT INTO t1 VALUES (1),(2),(3); EXPLAIN EXTENDED SELECT * FROM t1 WHERE ((c1 IS NOT NULL) >= (NOT TRUE)) IS NOT NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` is not null >= 0 is not null SELECT * FROM t1 WHERE ((c1 IS NOT NULL) >= (NOT TRUE)) IS NOT NULL; diff --git a/mysql-test/main/null_key.result b/mysql-test/main/null_key.result index 6b9d59c636a..c4c4d1fd6ac 100644 --- a/mysql-test/main/null_key.result +++ b/mysql-test/main/null_key.result @@ -4,41 +4,41 @@ insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9), Warnings: Warning 1062 Duplicate entry '6-6' for key 'a' explain select * from t1 where a is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 5 const 3 Using where; Using index explain select * from t1 where a is null and b = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a,b a 9 const,const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a,b a 9 const,const 1 Using where; Using index explain select * from t1 where a is null and b = 7; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a,b a 9 const,const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a,b a 9 const,const 1 Using where; Using index explain select * from t1 where a=2 and b = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const a,b a 9 const,const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const a,b a 9 const,const 1 Using index explain select * from t1 where a<=>b limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 9 NULL 12 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 9 NULL 12 Using where; Using index explain select * from t1 where (a is null or a > 0 and a < 2) and b < 5 limit 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a,b a 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a,b a 9 NULL 2 Using where; Using index explain select * from t1 where (a is null or a = 7) and b=7; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null a,b a 9 const,const 2 Using where; Using index explain select * from t1 where (a is null or a = 7) and b=7 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a,b a 9 const,const 2 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null a,b a 9 const,const 2 Using where; Using index; Using filesort explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a,b a 5 const 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a,b a 5 const 3 Using where; Using index explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a,b a 9 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a,b a 9 NULL 3 Using where; Using index explain select * from t1 where a > 1 and a < 3 limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 1 Using where; Using index explain select * from t1 where a > 8 and a < 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 1 Using where; Using index select * from t1 where a is null; a b NULL 7 @@ -77,44 +77,44 @@ create table t2 like t1; insert into t2 select * from t1; alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10)); explain select * from t1 where a is null and b = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a,b a 5 const 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a,b a 5 const 3 Using where explain select * from t1 where a is null and b = 2 and c=0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a,b a 5 const 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a,b a 5 const 3 Using where explain select * from t1 where a is null and b = 7 and c=0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a,b a 5 const 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a,b a 5 const 3 Using where explain select * from t1 where a=2 and b = 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a,b a 5 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a,b a 5 const 1 Using where explain select * from t1 where a<=>b limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 Using where explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a,b a 5 NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a,b a 5 NULL 5 Using where explain select * from t1 where (a is null or a = 7) and b=7 and c=0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a,b a 5 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null a,b a 5 const 4 Using where explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a,b a 5 const 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a,b a 5 const 3 Using where explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a,b a 5 const 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a,b a 5 const 3 Using where explain select * from t1 where a > 1 and a < 3 limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 1 Using where explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a,b a 5 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a,b a 5 NULL 4 Using where explain select * from t1 where a > 8 and a < 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 1 Using where explain select * from t1 where b like "6%"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range b b 12 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range b b 12 NULL 1 Using where select * from t1 where a is null; a b c NULL 7 0 @@ -152,23 +152,23 @@ rename table t2 to t1; alter table t1 modify b int null; insert into t1 values (7,null), (8,null), (8,7); explain select * from t1 where a = 7 and (b=7 or b is null); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a,b a 10 const,const 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null a,b a 10 const,const 2 Using where; Using index select * from t1 where a = 7 and (b=7 or b is null); a b 7 7 7 NULL explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a,b a 5 const 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null a,b a 5 const 5 Using where; Using index select * from t1 where (a = 7 or a is null) and (b=7 or b is null); a b 7 NULL 7 7 NULL 7 explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a a 5 const 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null a a 5 const 5 Using where; Using index select * from t1 where (a = 7 or a is null) and (a = 7 or a is null); a b 7 NULL @@ -179,22 +179,22 @@ NULL 9 create table t2 (a int); insert into t2 values (7),(8); explain select * from t2 straight_join t1 where t1.a=t2.a and b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t1 ref a,b a 10 test.t2.a,const 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t1 NULL ref a,b a 10 test.t2.a,const 2 Using where; Using index drop index b on t1; explain select * from t2,t1 where t1.a=t2.a and b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t1 ref a a 10 test.t2.a,const 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t1 NULL ref a a 10 test.t2.a,const 2 Using where; Using index select * from t2,t1 where t1.a=t2.a and b is null; a a b 7 7 NULL 8 8 NULL explain select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t1 NULL ref_or_null a a 10 test.t2.a,const 5 Using where; Using index select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null); a a b 7 7 7 @@ -202,9 +202,9 @@ a a b 8 8 7 8 8 NULL explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t1 ref_or_null a a 10 test.t2.a,const 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 NULL ref_or_null a a 10 test.t2.a,const 5 Using where; Using index select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7; a a b 7 7 7 @@ -212,9 +212,9 @@ a a b 8 8 7 8 NULL 7 explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t1 ref_or_null a a 5 test.t2.a 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 NULL ref_or_null a a 5 test.t2.a 5 Using where; Using index select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null); a a b 7 7 NULL @@ -226,13 +226,13 @@ a a b insert into t2 values (null),(6); delete from t1 where a=8; explain select * from t2,t1 where t1.a=t2.a or t1.a is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 -1 SIMPLE t1 ref_or_null a a 5 test.t2.a 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t1 NULL ref_or_null a a 5 test.t2.a 4 Using where; Using index explain select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 -1 SIMPLE t1 ref_or_null a a 5 test.t2.a 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t1 NULL ref_or_null a a 5 test.t2.a 4 Using where; Using index select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9); a a b 7 7 NULL @@ -260,11 +260,11 @@ INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4 INSERT INTO t1 VALUES (11,5),(12,6),(13,7),(14,8),(15,9); INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL); explain select id from t1 where uniq_id is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL idx1 NULL NULL NULL 15 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL idx1 NULL NULL NULL 15 Using where explain select id from t1 where uniq_id =1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const idx1 idx1 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const idx1 idx1 5 const 1 UPDATE t1 SET id=id+100 where uniq_id is null; UPDATE t2 SET id=id+100 where uniq_id is null; select id from t1 where uniq_id is null; @@ -416,10 +416,10 @@ COUNT(*) 15972 EXPLAIN SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 ref idx idx 5 test.t1.a 1 Using where -1 SIMPLE t3 ref idx idx 5 test.t2.b 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL ref idx idx 5 test.t1.a 1 Using where +1 SIMPLE t3 NULL ref idx idx 5 test.t2.b 1 Using where; Using index FLUSH STATUS ; SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b; diff --git a/mysql-test/main/odbc.result b/mysql-test/main/odbc.result index 3dbac12ca7c..a57822548c3 100644 --- a/mysql-test/main/odbc.result +++ b/mysql-test/main/odbc.result @@ -12,8 +12,8 @@ select * from t1 where a is null; a b 2 2 explain select * from t1 where b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE drop table t1; CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY); INSERT INTO t1 VALUES (NULL); diff --git a/mysql-test/main/olap.result b/mysql-test/main/olap.result index 93eda747d83..7bf9c1a738f 100644 --- a/mysql-test/main/olap.result +++ b/mysql-test/main/olap.result @@ -87,8 +87,8 @@ TV 2 NULL 200 TV NULL NULL 600 NULL NULL NULL 7785 explain extended select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 15 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 15 100.00 Using filesort Warnings: Note 1003 select `test`.`t1`.`product` AS `product`,`test`.`t1`.`country_id` AS `country_id`,`test`.`t1`.`year` AS `year`,sum(`test`.`t1`.`profit`) AS `sum(profit)` from `test`.`t1` group by `test`.`t1`.`product`,`test`.`t1`.`country_id`,`test`.`t1`.`year` with rollup select product, country_id , sum(profit) from t1 group by product desc, country_id with rollup; @@ -686,8 +686,8 @@ B C NULL EXPLAIN SELECT type FROM v1 GROUP BY type WITH ROLLUP; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using filesort DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (a int(11) NOT NULL); diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result index 226ab266789..34b21951548 100644 --- a/mysql-test/main/opt_trace.result +++ b/mysql-test/main/opt_trace.result @@ -583,8 +583,8 @@ create view v1 as select a from t1 group by b; create view v2 as select a from t2; # Mergeable view explain select * from v2 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain select * from v2 { "steps": [ @@ -694,9 +694,9 @@ explain select * from v2 { } 0 0 # Non-Mergeable view explain select * from v1 ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 10 -2 DERIVED t1 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 10 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 10 Using temporary; Using filesort QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain select * from v1 { "steps": [ @@ -902,9 +902,9 @@ Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a NULL NULL NULL 100 Using where -1 SIMPLE t2 ref a a 5 test.t1.b 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 100 Using where +1 SIMPLE t2 NULL ref a a 5 test.t1.b 1 Using where select * from information_schema.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b { @@ -1154,8 +1154,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT DISTINCT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 4 NULL 5 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 4 NULL 5 Using index for group-by select * from information_schema.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES EXPLAIN SELECT DISTINCT a FROM t1 { @@ -1319,8 +1319,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 20 NULL 8 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 20 NULL 8 Using where; Using index for group-by select * from information_schema.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a { @@ -1518,8 +1518,8 @@ INSERT INTO t1 values (1,'2001-01-01'),(1,'2001-01-02'), (4,'2001-01-03'),(4,'2001-01-04'); set optimizer_trace='enabled=on'; EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL id 8 NULL 9 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL id 8 NULL 9 Using where; Using index for group-by select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id { @@ -1706,8 +1706,8 @@ EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id { ] } 0 0 EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL id 8 NULL 9 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL id 8 NULL 9 Using where; Using index for group-by select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id { @@ -1921,8 +1921,8 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK set optimizer_trace='enabled=on'; explain select * from t1 where a=1 and b=2 order by c limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a_c,a_b a_c 5 NULL 180 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a_c,a_b a_c 5 NULL 180 Using where select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain select * from t1 where a=1 and b=2 order by c limit 1 { @@ -2298,8 +2298,8 @@ test.t3 analyze status OK # table t2 should be eliminated explain select t1.a from t1 left join t2 on t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain @@ -2436,9 +2436,9 @@ select t1.a from t1 left join t2 on t1.a=t2.a { } 0 0 # no tables should be eliminated explain select * from t1 left join t2 on t2.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain select * from t1 left join t2 on t2.a=t1.a { @@ -2617,8 +2617,8 @@ explain select * from t1 left join t2 on t2.a=t1.a { } 0 0 # multiple tables are eliminated explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and t3.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and t3.a=t1.a { @@ -2804,10 +2804,10 @@ test.t10 analyze status Engine-independent statistics collected test.t10 analyze status OK set optimizer_trace='enabled=on'; explain extended select * from t1 where a in (select pk from t10); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t10 ALL NULL NULL NULL NULL 10 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t10 NULL ALL NULL NULL NULL NULL 10 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join (`test`.`t10`) where 1 select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; @@ -3133,8 +3133,8 @@ set @@optimizer_use_condition_selectivity=4; set @@use_stat_tables= PREFERABLY; set optimizer_trace='enabled=on'; explain select * from t1 where pk = 2 and a=5 and b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref pk,pk_a,pk_a_b pk_a_b 15 const,const,const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref pk,pk_a,pk_a_b pk_a_b 15 const,const,const 1 Using index select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain select * from t1 where pk = 2 and a=5 and b=1 { @@ -3737,8 +3737,8 @@ insert into t0 select a,a from ten; alter table t0 add key(a); set optimizer_trace=1; explain delete from t0 where t0.a<3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 range a a 5 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL range a a 5 NULL 3 Using where select * from information_schema.optimizer_trace; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain delete from t0 where t0.a<3 { @@ -3806,9 +3806,9 @@ alter table t0 add key(a); create table t1 like t0; insert into t1 select * from t0; explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 range a a 5 NULL 3 Using where -1 SIMPLE t1 ref a a 5 test.t0.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL range a a 5 NULL 3 Using where +1 SIMPLE t1 NULL ref a a 5 test.t0.a 1 select * from information_schema.optimizer_trace; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 { @@ -4172,9 +4172,9 @@ set optimizer_trace=1; create table t1 (a int); insert into t1 values (1),(2),(3); explain select * from (select rand() from t1)q; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 -2 DERIVED t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain select * from (select rand() from t1)q { @@ -4379,11 +4379,11 @@ create table t2(a int); insert into t2 values (1),(2),(3),(1),(2),(3),(1),(2),(3); set @save_optimizer_switch= @@optimizer_switch; explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_inner_2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t_inner_1 ALL NULL NULL NULL NULL 3 -2 MATERIALIZED t_inner_2 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t_inner_1 NULL ALL NULL NULL NULL NULL 3 +2 MATERIALIZED t_inner_2 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_inner_2) { @@ -4827,13 +4827,13 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_ set optimizer_switch='materialization=off'; explain select * from t1 t_outer_1,t2 t_outer_2 where t_outer_1.a in (select t_inner_1.a from t2 t_inner_2, t1 t_inner_1) and t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t_outer_1 ALL NULL NULL NULL NULL 3 -1 PRIMARY t_inner_1 ALL NULL NULL NULL NULL 3 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY t_inner_2 ALL NULL NULL NULL NULL 9 End temporary; Using join buffer (incremental, BNL join) -1 PRIMARY t_inner_4 ALL NULL NULL NULL NULL 3 Start temporary; Using join buffer (incremental, BNL join) -1 PRIMARY t_outer_2 ALL NULL NULL NULL NULL 9 Using join buffer (incremental, BNL join) -1 PRIMARY t_inner_3 ALL NULL NULL NULL NULL 9 Using where; End temporary; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t_outer_1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY t_inner_1 NULL ALL NULL NULL NULL NULL 3 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t_inner_2 NULL ALL NULL NULL NULL NULL 9 End temporary; Using join buffer (incremental, BNL join) +1 PRIMARY t_inner_4 NULL ALL NULL NULL NULL NULL 3 Start temporary; Using join buffer (incremental, BNL join) +1 PRIMARY t_outer_2 NULL ALL NULL NULL NULL NULL 9 Using join buffer (incremental, BNL join) +1 PRIMARY t_inner_3 NULL ALL NULL NULL NULL NULL 9 Using where; End temporary; Using join buffer (incremental, BNL join) select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain select * from t1 t_outer_1,t2 t_outer_2 where t_outer_1.a in (select t_inner_1.a from t2 t_inner_2, t1 t_inner_1) and @@ -6405,15 +6405,15 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { set optimizer_switch='materialization=on'; explain select * from t1 t_outer_1,t2 t_outer_2 where t_outer_1.a in (select t_inner_1.a from t2 t_inner_2, t1 t_inner_1) and t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t_outer_1 ALL NULL NULL NULL NULL 3 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t_outer_2 ALL NULL NULL NULL NULL 9 Using join buffer (flat, BNL join) -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t_inner_1 ALL NULL NULL NULL NULL 3 -2 MATERIALIZED t_inner_2 ALL NULL NULL NULL NULL 9 Using join buffer (flat, BNL join) -3 MATERIALIZED t_inner_4 ALL NULL NULL NULL NULL 3 -3 MATERIALIZED t_inner_3 ALL NULL NULL NULL NULL 9 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t_outer_1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t_outer_2 NULL ALL NULL NULL NULL NULL 9 Using join buffer (flat, BNL join) +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t_inner_1 NULL ALL NULL NULL NULL NULL 3 +2 MATERIALIZED t_inner_2 NULL ALL NULL NULL NULL NULL 9 Using join buffer (flat, BNL join) +3 MATERIALIZED t_inner_4 NULL ALL NULL NULL NULL NULL 3 +3 MATERIALIZED t_inner_3 NULL ALL NULL NULL NULL NULL 9 Using join buffer (flat, BNL join) select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain select * from t1 t_outer_1,t2 t_outer_2 where t_outer_1.a in (select t_inner_1.a from t2 t_inner_2, t1 t_inner_1) and @@ -7522,8 +7522,8 @@ create table t1 ( a int, b int, key a_b(a,b)); insert into t1 select a,a from one_k; set optimizer_trace='enabled=on'; explain select * from t1 force index (a_b) where a=2 and b=4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a_b a_b 10 const,const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a_b a_b 10 const,const 1 Using index select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ @@ -7556,8 +7556,8 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) } ] explain select * from t1 where a >= 900 and b between 10 and 20; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a_b a_b 10 NULL 107 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a_b a_b 10 NULL 107 Using where; Using index select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ @@ -7593,8 +7593,8 @@ drop table t0,t1; create table t1 (start_date date, end_date date, filler char(100), key(start_date, end_date)) ; insert into t1 select date_add(now(), interval a day), date_add(now(), interval (a+7) day), 'data' from one_k; explain select * from t1 force index(start_date) where start_date >= '2019-02-10' and end_date <'2019-04-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range start_date start_date 8 NULL 1000 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range start_date start_date 8 NULL 1000 Using index condition select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ @@ -7638,8 +7638,8 @@ key a_b_c(a,b,c) ); insert into t1 select a,a, a,a from ten; explain select * from t1 force index(a_b_c) where a between 1 and 4 and b < 50; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a_b_c a_b_c 8 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a_b_c a_b_c 8 NULL 4 Using index condition select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ @@ -7677,8 +7677,8 @@ CREATE TABLE t1(i INT PRIMARY KEY, b BINARY(16), INDEX i_b(b)); INSERT INTO t1 VALUES (1, x'D95B94336A9946A39CF5B58CFE772D8C'); INSERT INTO t1 VALUES (2, NULL); EXPLAIN SELECT * FROM t1 WHERE b IN (0xD95B94336A9946A39CF5B58CFE772D8C); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref i_b i_b 17 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref i_b i_b 17 const 1 Using index condition select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ @@ -7711,8 +7711,8 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) } ] EXPLAIN SELECT * FROM t1 WHERE b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref i_b i_b 17 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref i_b i_b 17 const 1 Using index condition select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ @@ -7753,8 +7753,8 @@ INSERT INTO t1 VALUES (1, 'ab\n'); INSERT INTO t1 VALUES (2, NULL); set optimizer_trace=1; EXPLAIN SELECT * FROM t1 WHERE b='ab\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref i_b i_b 13 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref i_b i_b 13 const 1 Using index condition select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ @@ -7788,8 +7788,8 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) ] ALTER TABLE t1 modify column b BINARY(10) AFTER i; EXPLAIN SELECT * FROM t1 WHERE b='ab\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref i_b i_b 11 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref i_b i_b 11 const 1 Using index condition select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ @@ -7823,8 +7823,8 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) ] ALTER TABLE t1 modify column b VARBINARY(10) AFTER i; EXPLAIN SELECT * FROM t1 WHERE b='ab\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref i_b i_b 13 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref i_b i_b 13 const 1 Using index condition select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ @@ -7861,8 +7861,8 @@ CREATE TABLE t1(i INT PRIMARY KEY, b CHAR(10), INDEX i_b(b)); INSERT INTO t1 VALUES (1, 'ab\n'); INSERT INTO t1 VALUES (2, NULL); EXPLAIN SELECT * FROM t1 WHERE b='ab\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref i_b i_b 11 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref i_b i_b 11 const 1 Using index condition select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ @@ -7902,8 +7902,8 @@ INSERT INTO t1 VALUES (1, 'ab\n'); INSERT INTO t1 VALUES (2, NULL); set optimizer_trace=1; EXPLAIN SELECT * FROM t1 WHERE b= 'ab\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref i_b i_b 1003 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref i_b i_b 1003 const 1 Using where select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ @@ -7941,8 +7941,8 @@ INSERT INTO t1 VALUES (1, 'ab\n'); INSERT INTO t1 VALUES (2, 'ab\n'); set optimizer_trace=1; EXPLAIN SELECT * FROM t1 WHERE b='ab\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref i_b i_b 13 const 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref i_b i_b 13 const 2 Using index condition select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ @@ -8064,9 +8064,9 @@ set optimizer_trace=1; # but for joins using condition selectivity it is not as trivial. So, # now we are printing it) explain select * from t0 A, one_k B where A.a<5 and B.a<800; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE B ALL NULL NULL NULL NULL 1000 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE B NULL ALL NULL NULL NULL NULL 1000 Using where select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) [ @@ -8170,9 +8170,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) set join_cache_level=@tmp_jcl; # This shows post-join selectivity explain select * from t0 A, one_k B where A.a=B.b and B.a<800; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE B ref b b 5 test.A.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 10 Using where +1 SIMPLE B NULL ref b b 5 test.A.a 1 Using where select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) [ @@ -8291,8 +8291,8 @@ drop table t0, one_k; CREATE TABLE t1 ( a blob, KEY (a(255))); insert into t1 values ('foo'), ('bar'); EXPLAIN SELECT * FROM t1 WHERE a= REPEAT('a', 0); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 258 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 258 const 1 Using where SELECT * FROM t1 WHERE a= REPEAT('a', 0); a select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; @@ -8338,10 +8338,10 @@ create table t3 (a int); insert into t3 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); explain select * from t3 where (a,a) in (select t1.a, t2.a from t1, t2 where t1.b=t2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 5 -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where -1 PRIMARY t3 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 5 +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) select JSON_DETAILED(JSON_EXTRACT(trace, '$**.semijoin_table_pullout')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.semijoin_table_pullout')) [ @@ -8394,9 +8394,9 @@ CREATE TABLE t2(a INT, b INT, key(a)); INSERT INTO t2 SELECT seq, seq from seq_1_to_100; SET OPTIMIZER_TRACE=1; EXPLAIN SELECT * FROM t1, t2 WHERE t1.a=t2.a ORDER BY t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a NULL NULL NULL 10 Using where; Using temporary; Using filesort -1 SIMPLE t2 ref a a 5 test.t1.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 10 Using where; Using temporary; Using filesort +1 SIMPLE t2 NULL ref a a 5 test.t1.a 1 select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) [ @@ -8565,8 +8565,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN EXTENDED SELECT * from t1 WHERE a between 1 and 5 and b <= 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 100 0.25 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 100 0.25 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` between 1 and 5 and `test`.`t1`.`b` <= 5 select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; @@ -8595,8 +8595,8 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) ] ] EXPLAIN EXTENDED SELECT * from t1 WHERE a != 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 100 99.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 100 99.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` <> 5 select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; @@ -8617,8 +8617,8 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) ] ] EXPLAIN EXTENDED SELECT * from t1 WHERE b >= 10 and b < 25; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 100 15.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 100 15.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` >= 10 and `test`.`t1`.`b` < 25 select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; @@ -8835,10 +8835,10 @@ create table t3 (pk int primary key, a int); insert into t3 select a,a from t0; explain select * from t1 left join (t2 join t3 on t3.pk=1000) on t2.a=t1.a and t2.pk is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 const PRIMARY NULL NULL NULL 1 Impossible ON condition -1 SIMPLE t2 const PRIMARY NULL NULL NULL 1 Impossible ON condition -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL const PRIMARY NULL NULL NULL 1 Impossible ON condition +1 SIMPLE t2 NULL const PRIMARY NULL NULL NULL 1 Impossible ON condition +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 select JSON_DETAILED(JSON_EXTRACT(trace, '$**.mark_join_nest_as_const')) from information_schema.optimizer_trace; JSON_DETAILED(JSON_EXTRACT(trace, '$**.mark_join_nest_as_const')) @@ -8861,10 +8861,10 @@ INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); set @tmp=@@in_predicate_conversion_threshold; set in_predicate_conversion_threshold=3; explain select * from t0 where a in (1,2,3,4,5,6); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 10 Using where -1 PRIMARY <derived3> ref key0 key0 4 test.t0.a 2 FirstMatch(t0) -3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 10 Using where +1 PRIMARY <derived3> NULL ref key0 key0 4 test.t0.a 2 FirstMatch(t0) +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) @@ -8922,8 +8922,8 @@ json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) } ] explain select * from t0 where a in (1,2,3,4,5,a+1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) @@ -8936,8 +8936,8 @@ json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) } ] explain select * from t0 where a in ('1','2','3','4','5','6'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) from information_schema.optimizer_trace; json_detailed(json_extract(trace, '$**.in_to_subquery_conversion')) @@ -8964,10 +8964,10 @@ insert into t2 values (1,1),(2,2); create table t3 (a int, b int, c int); insert into t3 values (0,0,0),(1,1,1),(2,2,2),(3,3,3),(4,4,4); explain select * from t2,t1,t3 where t2.b= t1.b and t1.a=t3.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t3 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 ref PRIMARY PRIMARY 8 test.t3.a,test.t2.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 8 test.t3.a,test.t2.b 1 Using index set @trace=(select trace from information_schema.optimizer_trace); set @path= (select json_search(@trace, 'one', 'no predicate for first keypart')); set @sub_path= substr(@path, 2, locate('.best_access_path', @path)-2); @@ -9006,8 +9006,8 @@ from t1 where a=3 group by b,b having a+b < 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort select json_detailed(json_extract(trace, '$**.substitute_best_equal')) from @@ -9032,9 +9032,9 @@ select from t1 left join t2 on t2.a=t1.a and t2.a<3 where t1.b > 5555; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) select json_detailed(json_extract(trace, '$**.substitute_best_equal')) from @@ -9060,10 +9060,10 @@ select from t1 left join (t2,t3) on t2.a=t1.a and t3.a=t2.a and t3.a + t2.a <1000 where t1.b > 5555; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (incremental, BNL join) select json_detailed(json_extract(trace, '$**.substitute_best_equal')) from @@ -9155,10 +9155,10 @@ from t1 join (select a, sum(t2.b) as s, min(t2.c) as m from t2 group by t2.a) t on t1.a=t.a where t1.b < 3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range idx_b idx_b 5 NULL 4 Using index condition; Using where -1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 2 -2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range idx_b idx_b 5 NULL 4 Using index condition; Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.a 2 +2 LATERAL DERIVED t2 NULL ref idx_a idx_a 5 test.t1.a 1 select json_detailed(json_extract(trace, '$**.choose_best_splitting')) from diff --git a/mysql-test/main/opt_trace_index_merge.result b/mysql-test/main/opt_trace_index_merge.result index f1e13586eda..9b851dce97c 100644 --- a/mysql-test/main/opt_trace_index_merge.result +++ b/mysql-test/main/opt_trace_index_merge.result @@ -13,8 +13,8 @@ A.a, from t0 A, t0 B, t0 C; This should use union: explain select * from t1 where a=1 or b=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 2 Using union(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 2 Using union(a,b); Using where select * from information_schema.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain select * from t1 where a=1 or b=1 { @@ -307,8 +307,8 @@ insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 100, 100, 'key4 set optimizer_trace='enabled=on'; # 3-way ROR-intersection explain select key1,key2,key3 from t1 where key1=100 and key2=100 and key3=100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 2 Using intersect(key1,key2,key3); Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 2 Using intersect(key1,key2,key3); Using where; Using index select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ @@ -470,8 +470,8 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary')) ] # ROR-union(ROR-intersection, ROR-range) explain select key1,key2,key3,key4 from t1 where key1=100 and key2=100 or key3=100 and key4=100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 Using union(intersect(key1,key2),intersect(key3,key4)); Using where select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) [ diff --git a/mysql-test/main/opt_trace_index_merge_innodb.result b/mysql-test/main/opt_trace_index_merge_innodb.result index fbc7faa0d04..b13db022a59 100644 --- a/mysql-test/main/opt_trace_index_merge_innodb.result +++ b/mysql-test/main/opt_trace_index_merge_innodb.result @@ -21,8 +21,8 @@ set optimizer_trace="enabled=on"; set @tmp_index_merge_ror_cpk=@@optimizer_switch; set optimizer_switch='extended_keys=off'; explain select * from t1 where pk1 != 0 and key1 = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref PRIMARY,key1 key1 4 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref PRIMARY,key1 key1 4 const 1 Using index condition select * from information_schema.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES explain select * from t1 where pk1 != 0 and key1 = 1 { diff --git a/mysql-test/main/opt_tvc.result b/mysql-test/main/opt_tvc.result index 9752aa71bfb..2c72c1f59c8 100644 --- a/mysql-test/main/opt_tvc.result +++ b/mysql-test/main/opt_tvc.result @@ -22,8 +22,8 @@ a b 1 1 2 5 explain extended select * from t1 where a in (1,2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` in (1,2) # set minimum number of values in VALUEs list when optimization works to 2 @@ -45,11 +45,11 @@ a b 1 1 2 5 explain extended select * from t1 where a in (1,2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where 1 explain extended select * from t1 @@ -58,11 +58,11 @@ where a in select * from (values (1),(2)) as tvc_0 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where 1 # AND-condition with IN-predicates in WHERE-part @@ -89,14 +89,14 @@ a b explain extended select * from t1 where a in (1,2) and b in (1,5); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 func 1 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -4 MATERIALIZED <derived5> ALL NULL NULL NULL NULL 2 100.00 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 2 100.00 -5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery4> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +4 MATERIALIZED <derived5> NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) semi join ((values (1),(5)) `tvc_1`) where 1 explain extended select * from t1 @@ -110,14 +110,14 @@ and b in select * from (values (1),(5)) as tvc_1 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 func 1 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -4 MATERIALIZED <derived5> ALL NULL NULL NULL NULL 2 100.00 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 2 100.00 -5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery4> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +4 MATERIALIZED <derived5> NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) semi join ((values (1),(5)) `tvc_1`) where 1 # subquery with IN-predicate @@ -147,12 +147,12 @@ where a in select a from t2 where b in (3,4) ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED <derived4> NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (3),(4)) `tvc_0` join `test`.`t2`) where `test`.`t2`.`b` = `tvc_0`.`_col_1` explain extended select * from t1 @@ -165,12 +165,12 @@ select * from (values (3),(4)) as tvc_0 ) ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED <derived4> NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (3),(4)) `tvc_0` join `test`.`t2`) where `test`.`t2`.`b` = `tvc_0`.`3` # derived table with IN-predicate @@ -205,11 +205,11 @@ select * from t1 where a in (1,2) ) as dr_table; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -3 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2 100.00 -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED <derived4> NULL ALL NULL NULL NULL NULL 2 100.00 +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where 1 explain extended select * from @@ -223,11 +223,11 @@ from (values (1),(2)) as tvc_0 ) ) as dr_table; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -3 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2 100.00 -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED <derived4> NULL ALL NULL NULL NULL NULL 2 100.00 +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where 1 # non-recursive CTE with IN-predicate @@ -264,11 +264,11 @@ from t1 where a in (1,2) ) select * from tvc_0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -3 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2 100.00 -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED <derived4> NULL ALL NULL NULL NULL NULL 2 100.00 +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 with tvc_0 as (/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where `test`.`t1`.`a` in (1,2))/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where 1 explain extended select * from @@ -282,11 +282,11 @@ from (values (1),(2)) as tvc_0 ) ) as dr_table; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -3 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2 100.00 -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED <derived4> NULL ALL NULL NULL NULL NULL 2 100.00 +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where 1 # VIEW with IN-predicate @@ -315,19 +315,19 @@ a b 1 1 2 5 explain extended select * from v1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -3 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2 100.00 -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED <derived4> NULL ALL NULL NULL NULL NULL 2 100.00 +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where 1 explain extended select * from v2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -3 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2 100.00 -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED <derived4> NULL ALL NULL NULL NULL NULL 2 100.00 +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where 1 drop view v1,v2; @@ -379,12 +379,12 @@ where a in (1,2) ) as dr_table ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED <derived5> ALL NULL NULL NULL NULL 2 100.00 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) -5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED <derived5> NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0` join `test`.`t1`) where `test`.`t1`.`a` = 1 and `test`.`t1`.`a` = `tvc_0`.`_col_1` explain extended select * from t1 @@ -404,12 +404,12 @@ as tvc_0 ) as dr_table ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED <derived5> ALL NULL NULL NULL NULL 2 100.00 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) -5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED <derived5> NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0` join `test`.`t1`) where `test`.`t1`.`a` = 1 and `test`.`t1`.`a` = `tvc_0`.`1` # derived table with IN-predicate and group by @@ -443,12 +443,12 @@ from t1 where b in (3,5) group by b ) as dr_table; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 6 100.00 Using temporary; Using filesort -2 DERIVED <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -3 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2 100.00 -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 12 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using temporary; Using filesort +2 DERIVED <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED <derived4> NULL ALL NULL NULL NULL NULL 2 100.00 +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `dr_table`.`max(a)` AS `max(a)`,`dr_table`.`b` AS `b` from (/* select#2 */ select max(`test`.`t1`.`a`) AS `max(a)`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (3),(5)) `tvc_0`) where 1 group by `test`.`t1`.`b`) `dr_table` explain extended select * from @@ -463,12 +463,12 @@ as tvc_0 ) group by b ) as dr_table; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 6 100.00 Using temporary; Using filesort -2 DERIVED <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -3 MATERIALIZED <derived4> ALL NULL NULL NULL NULL 2 100.00 -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 12 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using temporary; Using filesort +2 DERIVED <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED <derived4> NULL ALL NULL NULL NULL NULL 2 100.00 +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `dr_table`.`max(a)` AS `max(a)`,`dr_table`.`b` AS `b` from (/* select#2 */ select max(`test`.`t1`.`a`) AS `max(a)`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (3),(5)) `tvc_0`) where 1 group by `test`.`t1`.`b`) `dr_table` # prepare statement @@ -493,8 +493,8 @@ a b 1 sm 4 yq explain extended select * from t3 where a in (1,4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 range idx idx 5 NULL 4 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range idx idx 5 NULL 4 100.00 Using index condition Warnings: Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t3` where `test`.`t3`.`a` in (1,4) set @@in_predicate_conversion_threshold= 2; @@ -505,11 +505,11 @@ a b 1 sm 4 yq explain extended select * from t3 where a in (1,4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2 100.00 -1 PRIMARY t3 ref idx idx 5 tvc_0._col_1 3 100.00 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 100.00 +1 PRIMARY t3 NULL ref idx idx 5 tvc_0._col_1 3 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t3` semi join ((values (1),(4)) `tvc_0`) where `test`.`t3`.`a` = `tvc_0`.`_col_1` # use vectors in IN predeicate @@ -518,11 +518,11 @@ select * from t1 where (a,b) in ((1,2),(3,4)); a b 1 2 explain extended select * from t1 where (a,b) in ((1,2),(3,4)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1,2),(3,4)) `tvc_0`) where 1 set @@in_predicate_conversion_threshold= 2; @@ -537,11 +537,11 @@ a b c explain extended select * from t2 where (a,b) in ((1,2),(8,9)) and (a,c) in ((1,3),(8,0),(5,1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 3 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 3 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` semi join ((values (1,3),(8,0),(5,1)) `tvc_0`) where (`test`.`t2`.`a`,`test`.`t2`.`b`) in (<cache>((1,2)),<cache>((8,9))) set @@in_predicate_conversion_threshold= 2; @@ -566,18 +566,18 @@ a b 7 8 explain extended select * from t1 where (a,b) not in ((1,2),(8,9), (5,1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 8 func,func 2 100.00 Using where; Full scan on NULL key -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY <derived3> NULL index_subquery key0 key0 8 func,func 2 100.00 Using where; Full scan on NULL key +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`>(<in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in (temporary) on key0 where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`_col_1`) and trigcond(<cache>(`test`.`t1`.`b`) = `tvc_0`.`_col_2`))))) explain extended select * from t1 where (a,b) not in (select * from (values (1,2),(8,9), (5,1)) as tvc_0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 8 func,func 2 100.00 Using where; Full scan on NULL key -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY <derived3> NULL index_subquery key0 key0 8 func,func 2 100.00 Using where; Full scan on NULL key +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`>(<in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in (temporary) on key0 where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`1`) and trigcond(<cache>(`test`.`t1`.`b`) = `tvc_0`.`2`))))) select * from t1 @@ -588,10 +588,10 @@ a b 2 5 explain extended select * from t1 where b < 7 and (a,b) not in ((1,2),(8,9), (5,1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 8 func,func 2 100.00 Using where; Full scan on NULL key -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY <derived3> NULL index_subquery key0 key0 8 func,func 2 100.00 Using where; Full scan on NULL key +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` < 7 and !<expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`>(<in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in (temporary) on key0 where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`_col_1`) and trigcond(<cache>(`test`.`t1`.`b`) = `tvc_0`.`_col_2`))))) select * from t2 @@ -604,10 +604,10 @@ a b c 10 7 1 explain extended select * from t2 where (a,c) not in ((1,2),(8,9), (5,1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 8 func,func 2 100.00 Using where; Full scan on NULL key -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY <derived3> NULL index_subquery key0 key0 8 func,func 2 100.00 Using where; Full scan on NULL key +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`c`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`c`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in (temporary) on key0 where trigcond(<cache>(`test`.`t2`.`a`) = `tvc_0`.`_col_1`) and trigcond(<cache>(`test`.`t2`.`c`) = `tvc_0`.`_col_2`))))) drop table t1, t2, t3; @@ -620,16 +620,16 @@ INSERT INTO t1 VALUES (3), (2), (7); SELECT * FROM t1 WHERE i IN (NULL, NULL, NULL, NULL, NULL); i EXPLAIN EXTENDED SELECT * FROM t1 WHERE i IN (NULL, NULL, NULL, NULL, NULL); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` in (NULL,NULL,NULL,NULL,NULL) SET in_predicate_conversion_threshold= 5; SELECT * FROM t1 WHERE i IN (NULL, NULL, NULL, NULL, NULL); i EXPLAIN EXTENDED SELECT * FROM t1 WHERE i IN (NULL, NULL, NULL, NULL, NULL); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` in (NULL,NULL,NULL,NULL,NULL) SET in_predicate_conversion_threshold= default; @@ -692,8 +692,8 @@ create table t1(a int, b int); insert into t1 select seq-1, seq-1 from seq_1_to_10; set in_predicate_conversion_threshold=2; explain select * from t1 where t1.a IN ("1","2","3","4"); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using where select * from t1 where t1.a IN ("1","2","3","4"); a b 1 1 @@ -702,8 +702,8 @@ a b 4 4 set in_predicate_conversion_threshold=0; explain select * from t1 where t1.a IN ("1","2","3","4"); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using where select * from t1 where t1.a IN ("1","2","3","4"); a b 1 1 @@ -712,8 +712,8 @@ a b 4 4 set in_predicate_conversion_threshold=2; explain select * from t1 where (t1.a,t1.b) in (("1","1"),(2,2),(3,3),(4,4)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using where select * from t1 where (t1.a,t1.b) in (("1","1"),(2,2),(3,3),(4,4)); a b 1 1 @@ -722,8 +722,8 @@ a b 4 4 set in_predicate_conversion_threshold=0; explain select * from t1 where (t1.a,t1.b) in (("1","1"),(2,2),(3,3),(4,4)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using where select * from t1 where (t1.a,t1.b) in (("1","1"),(2,2),(3,3),(4,4)); a b 1 1 diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result index 3735700f315..ec4463b3f6e 100644 --- a/mysql-test/main/order_by.result +++ b/mysql-test/main/order_by.result @@ -295,15 +295,15 @@ create table t1 (a int not null, b int, c varchar(10), key (a, b, c)); insert into t1 values (1, NULL, NULL), (1, NULL, 'b'), (1, 1, NULL), (1, 1, 'b'), (1, 1, 'b'), (2, 1, 'a'), (2, 1, 'b'), (2, 2, 'a'), (2, 2, 'b'), (2, 3, 'c'),(1,3,'b'); insert into t1 select * from t1; explain select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 22 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 22 NULL 3 Using where; Using index select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc; a b c 1 NULL b 1 NULL b explain select * from t1 where a >= 1 and a < 3 order by a desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL 22 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 4 NULL 22 Using where; Using index select * from t1 where a >= 1 and a < 3 order by a desc; a b c 2 3 c @@ -329,8 +329,8 @@ a b c 1 NULL NULL 1 NULL NULL explain select * from t1 where a = 1 order by a desc, b desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 4 const 12 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 4 const 12 Using where; Using index select * from t1 where a = 1 order by a desc, b desc; a b c 1 3 b @@ -346,8 +346,8 @@ a b c 1 NULL NULL 1 NULL NULL explain select * from t1 where a = 1 and b is null order by a desc, b desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 9 const,const 4 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 9 const,const 4 Using where; Using index; Using filesort select * from t1 where a = 1 and b is null order by a desc, b desc; a b c 1 NULL NULL @@ -355,33 +355,33 @@ a b c 1 NULL b 1 NULL b explain select * from t1 where a >= 1 and a < 3 and b >0 order by a desc,b desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 9 NULL 18 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 9 NULL 18 Using where; Using index explain select * from t1 where a = 2 and b >0 order by a desc,b desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 9 NULL 10 Using where; Using index explain select * from t1 where a = 2 and b is null order by a desc,b desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 9 const,const 1 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 9 const,const 1 Using where; Using index; Using filesort explain select * from t1 where a = 2 and (b is null or b > 0) order by a desc,b desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 9 NULL 11 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 9 NULL 11 Using where; Using index explain select * from t1 where a = 2 and b > 0 order by a desc,b desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 9 NULL 10 Using where; Using index explain select * from t1 where a = 2 and b < 2 order by a desc,b desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 9 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 9 NULL 4 Using where; Using index explain select * from t1 where a = 1 order by b desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 4 const 12 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 4 const 12 Using where; Using index explain select * from t1 where a = 2 and b > 0 order by a desc,b desc,b,a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 9 NULL 10 Using where; Using index explain select * from t1 where a = 2 and b < 2 order by a desc,a,b desc,a,b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 9 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 9 NULL 4 Using where; Using index select * from t1 where a = 1 order by b desc; a b c 1 3 b @@ -408,8 +408,8 @@ Warning 1265 Data truncated for column 'c' at row 12 Warning 1265 Data truncated for column 'b' at row 13 Warning 1265 Data truncated for column 'c' at row 14 explain select * from t1 order by a, b, c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 20 NULL 22 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 20 NULL 22 Using index select * from t1 order by a, b, c; a b c 1 0 @@ -435,8 +435,8 @@ a b c 2 3 c 2 3 c explain select * from t1 order by a desc, b desc, c desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 20 NULL 22 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 20 NULL 22 Using index select * from t1 order by a desc, b desc, c desc; a b c 2 3 c @@ -462,8 +462,8 @@ a b c 1 0 1 0 explain select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 20 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 20 NULL 5 Using where; Using index select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc; a b c 1 1 b @@ -471,8 +471,8 @@ a b c 1 1 b 1 1 b explain select * from t1 where a < 2 and b <= 1 order by a desc, b desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL 12 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 4 NULL 12 Using where; Using index select * from t1 where a < 2 and b <= 1 order by a desc, b desc; a b c 1 1 b @@ -509,8 +509,8 @@ a b c 1 1 1 1 explain select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 8 NULL 22 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 8 NULL 22 Using where; Using index select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc; a b c 2 1 b @@ -528,8 +528,8 @@ a b c 1 0 1 0 explain select * from t1 where a between 0 and 1 order by a desc, b desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL 12 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 4 NULL 12 Using where; Using index select * from t1 where a between 0 and 1 order by a desc, b desc; a b c 1 3 b @@ -585,27 +585,27 @@ gid sid uid 104505 5 117 103853 5 250 EXPLAIN select t1.gid, t2.sid, t3.uid from t3, t2, t1 where t2.gid = t1.gid and t2.uid = t3.uid order by t1.gid, t3.uid; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL PRIMARY,uid NULL NULL NULL 6 Using temporary; Using filesort -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t2.uid 1 Using where; Using index -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.gid 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL PRIMARY,uid NULL NULL NULL 6 Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 2 test.t2.uid 1 Using where; Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.gid 1 Using index EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.uid 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.uid 1 Using where; Using index EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL PRIMARY,uid NULL NULL NULL 6 Using temporary; Using filesort -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.gid 1 Using index -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t2.uid 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL PRIMARY,uid NULL NULL NULL 6 Using temporary; Using filesort +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.gid 1 Using index +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 2 test.t2.uid 1 Using where; Using index EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t3.skr,t1.gid; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.uid 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.uid 1 Using where; Using index EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 Using index condition drop table t1,t2,t3; CREATE TABLE t1 ( `titre` char(80) NOT NULL default '', @@ -675,11 +675,11 @@ a b DROP TABLE t1; create table t1(id int not null auto_increment primary key, t char(12)); explain select id,t from t1 order by id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 Using filesort explain select id,t from t1 force index (primary) order by id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 1000 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 1000 drop table t1; CREATE TABLE t1 ( FieldKey varchar(36) NOT NULL default '', @@ -691,8 +691,8 @@ KEY StringField (FieldKey,StringVal(32)) ); INSERT INTO t1 VALUES ('0',3,'0'),('0',2,'1'),('0',1,'2'),('1',2,'1'),('1',1,'3'), ('1',0,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('3',2,'1'),('3',1,'2'),('3','3','3'); EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref FieldKey,LongField,StringField LongField 38 const 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref FieldKey,LongField,StringField LongField 38 const 3 Using where SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; FieldKey LongVal StringVal 1 0 2 @@ -701,19 +701,19 @@ FieldKey LongVal StringVal DS-MRR: use two IGNORE INDEX queries, otherwise we get cost races, because DS-MRR: records_in_range/read_time return the same numbers for all three indexes EXPLAIN SELECT * FROM t1 IGNORE INDEX (LongField, StringField) WHERE FieldKey > '2' ORDER BY LongVal; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range FieldKey FieldKey 38 NULL 3 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range FieldKey FieldKey 38 NULL 3 Using index condition; Using filesort EXPLAIN SELECT * FROM t1 IGNORE INDEX (FieldKey, LongField) WHERE FieldKey > '2' ORDER BY LongVal; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range StringField StringField 38 NULL 3 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range StringField StringField 38 NULL 3 Using where; Using filesort SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; FieldKey LongVal StringVal 3 1 2 3 2 1 3 3 3 EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range FieldKey,LongField,StringField LongField 38 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range FieldKey,LongField,StringField LongField 38 NULL 3 Using where SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal; FieldKey LongVal StringVal 3 1 2 @@ -734,8 +734,8 @@ create table t1(a int, b int, index(b)); insert into t1 values (2, 1), (1, 1), (4, NULL), (3, NULL), (6, 2), (5, 2); insert into t1 values (12, 11), (11, 11), (14, 3), (13, 5), (16, 12), (15, 12); explain select * from t1 where b=1 or b is null order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null b b 5 const 4 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null b b 5 const 4 Using index condition; Using filesort select * from t1 where b=1 or b is null order by a; a b 1 1 @@ -743,8 +743,8 @@ a b 3 NULL 4 NULL explain select * from t1 where b=2 or b is null order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null b b 5 const 4 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null b b 5 const 4 Using index condition; Using filesort select * from t1 where b=2 or b is null order by a; a b 3 NULL @@ -880,8 +880,8 @@ insert into t1 (`sid`, `wnid`) values ('25292','02071450000'),('25293','02071460000'),('25294','02071470000'), ('25295','02071491000'),('25296','02071491000'),('25297','02071499000'); explain select * from t1 where wnid like '0101%' order by wnid; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range wnid14,wnid wnid 13 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range wnid14,wnid wnid 13 NULL 4 Using where select * from t1 where wnid like '0101%' order by wnid; sid wnid 10100 01019000000 @@ -1093,9 +1093,9 @@ INSERT INTO t1 VALUES (1,1), (2,2), (3,3); explain SELECT t1.b as a, t2.b as c FROM t1 LEFT JOIN t1 t2 ON (t1.a = t2.a AND t2.a = 2) ORDER BY c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary; Using filesort +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 Using where SELECT t2.b as c FROM t1 LEFT JOIN t1 t2 ON (t1.a = t2.a AND t2.a = 2) ORDER BY c; @@ -1106,9 +1106,9 @@ NULL explain SELECT t1.b as a, t2.b as c FROM t1 JOIN t1 t2 ON (t1.a = t2.a AND t2.a = 2) ORDER BY c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 CREATE TABLE t2 LIKE t1; INSERT INTO t2 SELECT * from t1; CREATE TABLE t3 LIKE t1; @@ -1160,9 +1160,9 @@ INSERT INTO t1 VALUES (1,1),(2,2); CREATE TABLE t2 (a INT, b INT, KEY a (a,b)); INSERT INTO t2 VALUES (1,1),(1,2),(2,1),(2,2); EXPLAIN SELECT 1 FROM t1,t2 WHERE t1.b=2 AND t1.a=t2.a ORDER BY t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY,b b 5 const 1 -1 SIMPLE t2 ref a a 5 const 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY,b b 5 const 1 +1 SIMPLE t2 NULL ref a a 5 const 2 Using where; Using index DROP TABLE t1,t2; CREATE TABLE t1( id int auto_increment PRIMARY KEY, c2 int, c3 int, INDEX k2(c2), INDEX k3(c3)); @@ -1188,17 +1188,17 @@ COUNT(*) CREATE TABLE t2 LIKE t1; INSERT INTO t2 SELECT * FROM t1 ORDER BY id; EXPLAIN SELECT id,c3 FROM t2 WHERE c2=11 ORDER BY c3 LIMIT 20; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index k2 k3 5 NULL 111 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index k2 k3 5 NULL 111 Using where EXPLAIN SELECT id,c3 FROM t2 WHERE c2=11 ORDER BY c3 LIMIT 4000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index k2 k3 5 NULL 22318 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index k2 k3 5 NULL 22318 Using where EXPLAIN SELECT id,c3 FROM t2 WHERE c2 BETWEEN 10 AND 12 ORDER BY c3 LIMIT 20; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index k2 k3 5 NULL 73 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index k2 k3 5 NULL 73 Using where EXPLAIN SELECT id,c3 FROM t2 WHERE c2 BETWEEN 20 AND 30 ORDER BY c3 LIMIT 4000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range k2 k2 5 NULL 386 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range k2 k2 5 NULL 386 Using index condition; Using filesort SELECT id,c3 FROM t2 WHERE c2=11 ORDER BY c3 LIMIT 20; id c3 6 14 @@ -1235,8 +1235,8 @@ INSERT INTO t1 SELECT a +16, b +16 FROM t1; INSERT INTO t1 SELECT a +32, b +32 FROM t1; INSERT INTO t1 SELECT a +64, b +64 FROM t1; EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (a, ab) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 128 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 128 Using index SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (a, ab) GROUP BY a; a 1 @@ -1371,8 +1371,8 @@ SELECT @tmp_tables_after = @tmp_tables_before ; @tmp_tables_after = @tmp_tables_before 1 EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (a, ab) ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 128 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 128 Using index SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (a, ab) ORDER BY a; a 1 @@ -1550,8 +1550,8 @@ INSERT INTO t1 VALUES (1, 10), (2, NULL); # Must use ref-or-null on the a_c index EXPLAIN SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null a_c,a a_c 10 const,const 2 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null a_c,a a_c 10 const,const 2 Using where; Using index; Using filesort # Must return 1 row SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; col @@ -1559,8 +1559,8 @@ col # Must use ref-or-null on the a_c index EXPLAIN SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC; -id select_type table type possible_keys key key_len ref rows Extra -x x x ref_or_null a_c,a x x x x x +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x ref_or_null a_c,a x x x x x # Must return 1 row SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC; col @@ -1576,9 +1576,9 @@ EXPLAIN SELECT d FROM t1, t2 WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE' ORDER BY t2.c LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a,b b 4 const 4 Using index condition; Using where; Using temporary; Using filesort -1 SIMPLE t2 ref a,b,c a 40 test.t1.a,const 11 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a,b b 4 const 4 Using index condition; Using where; Using temporary; Using filesort +1 SIMPLE t2 NULL ref a,b,c a 40 test.t1.a,const 11 Using index condition SELECT d FROM t1, t2 WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE' ORDER BY t2.c LIMIT 1; @@ -1588,9 +1588,9 @@ EXPLAIN SELECT d FROM t3 AS t1, t2 AS t2 WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE' ORDER BY t2.c LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a,b,c c 5 NULL 420 Using where -1 SIMPLE t1 eq_ref a a 39 test.t2.a,const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a,b,c c 5 NULL 420 Using where +1 SIMPLE t1 NULL eq_ref a a 39 test.t2.a,const 1 Using where; Using index SELECT d FROM t3 AS t1, t2 AS t2 WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE' ORDER BY t2.c LIMIT 1; @@ -2516,8 +2516,8 @@ INSERT INTO t1 VALUES (25, 7, 1), (26, 7, 2), (27, 7, 3), (28, 7, 4); INSERT INTO t1 VALUES (29, 8, 1), (30, 8, 2), (31, 8, 3), (32, 8, 4); INSERT INTO t1 VALUES (33, 9, 1), (34, 9, 2), (35, 9, 3), (36, 9, 4); EXPLAIN SELECT id1 FROM t1 WHERE id2 = 4 ORDER BY id1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref id2_j_id1 id2_j_id1 4 const 4 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref id2_j_id1 id2_j_id1 4 const 4 Using where; Using index; Using filesort SELECT id1 FROM t1 WHERE id2 = 4 ORDER BY id1; id1 13 @@ -2553,8 +2553,8 @@ INSERT INTO t1 SELECT a + 640, b, c FROM t1; INSERT INTO t1 SELECT a + 1280, b, c FROM t1 LIMIT 80; EXPLAIN SELECT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range b,b_2 b 4 NULL 226 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range b,b_2 b 4 NULL 226 Using where SELECT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 9; a 2071 @@ -2568,8 +2568,8 @@ a 1991 EXPLAIN SELECT DISTINCT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 0, 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range b,b_2 b 4 NULL 226 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range b,b_2 b 4 NULL 226 Using where; Using temporary SELECT DISTINCT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 0, 9; a 2071 @@ -2596,21 +2596,21 @@ INSERT INTO t2 SELECT a+4, b FROM t2; # shouldn't have "using filesort" EXPLAIN SELECT * FROM t1 FORCE INDEX FOR ORDER BY (a), t2 WHERE t1.a < 2 ORDER BY t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using index condition; Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 Using index condition; Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) # should have "using filesort" EXPLAIN SELECT * FROM t1 USE INDEX FOR ORDER BY (a), t2 WHERE t1.a < 2 ORDER BY t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using index condition; Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 Using index condition; Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) # should have "using filesort" EXPLAIN SELECT * FROM t1 FORCE INDEX FOR JOIN (a), t2 WHERE t1.a < 2 ORDER BY t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using index condition; Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 Using index condition; Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) DROP TABLE t1, t2; # # Bug #50394: Regression in EXPLAIN with index scan, LIMIT, GROUP BY and @@ -2629,9 +2629,9 @@ WHERE t2.b = 1 GROUP BY t1.a ORDER by c LIMIT 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 8 NULL 10 Using index; Using temporary; Using filesort -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 8 NULL 10 Using index; Using temporary; Using filesort +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where DROP TABLE t1, t2; # # Bug #707848: WHERE condition with OR + ORDER BY + field substitution @@ -2643,9 +2643,9 @@ EXPLAIN EXTENDED SELECT * FROM t1 r JOIN t1 s ON r.a = s.a WHERE s.a IN (2,9) OR s.a < 100 AND s.a != 0 ORDER BY 1 LIMIT 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE r range PRIMARY PRIMARY 4 NULL 12 100.00 Using where; Using index -1 SIMPLE s eq_ref PRIMARY PRIMARY 4 test.r.a 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE r NULL range PRIMARY PRIMARY 4 NULL 12 100.00 Using where; Using index +1 SIMPLE s NULL eq_ref PRIMARY PRIMARY 4 test.r.a 1 100.00 Using index Warnings: Note 1003 select `test`.`r`.`a` AS `a`,`test`.`s`.`a` AS `a` from `test`.`t1` `r` join `test`.`t1` `s` where `test`.`s`.`a` = `test`.`r`.`a` and (`test`.`r`.`a` in (2,9) or `test`.`r`.`a` < 100 and `test`.`r`.`a` <> 0) order by 1 limit 10 SELECT * FROM t1 r JOIN t1 s ON r.a = s.a @@ -2674,8 +2674,8 @@ SELECT DISTINCT <col>... ORDER BY <col> DESC CREATE TABLE t1 (a INT,KEY (a)); INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); EXPLAIN SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 Using where; Using index SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC; a 1 10 1 @@ -2709,10 +2709,10 @@ EXPLAIN EXTENDED SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2 LEFT JOIN t3 ON t2.i2 = t3.i3 ORDER BY t1.i1 LIMIT 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 0.00 Const row not found -1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 5 100.00 Using index -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i1 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 SIMPLE t1 NULL index PRIMARY PRIMARY 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.i1 1 100.00 Using index Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`i2` = `test`.`t1`.`i1` order by `test`.`t1`.`i1` limit 5 SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2 @@ -2751,30 +2751,30 @@ b # field1 removed from ORDER BY explain extended SELECT t2.b AS field1 FROM t1, t2 WHERE t1.b = t2.a GROUP BY field1 ORDER BY t1.b, field1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Warnings: Note 1003 select `test`.`t2`.`b` AS `field1` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` group by `test`.`t2`.`b` order by `test`.`t1`.`b` explain extended SELECT t2.b, t1.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b, t2.b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Warnings: Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` group by `test`.`t2`.`b` order by `test`.`t1`.`b` explain extended SELECT t2.b,t1.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Warnings: Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` group by `test`.`t2`.`b` order by `test`.`t1`.`b` explain extended SELECT t2.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary; Using filesort +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Warnings: Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`b` group by `test`.`t2`.`b` order by `test`.`t1`.`b` drop table t1,t2; @@ -2925,8 +2925,8 @@ analyze table t1; explain select b, count(*) num_cnt from t1 where a > 9750 group by b order by num_cnt; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1 idx1 5 NULL 503 Using where; Using index; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1 idx1 5 NULL 503 Using where; Using index; Using temporary; Using filesort flush status; select b, count(*) num_cnt from t1 where a > 9750 group by b order by num_cnt; @@ -2944,8 +2944,8 @@ Handler_read_rnd_next 250 explain select b, count(*) num_cnt from t1 where a > 9750 group by b order by num_cnt limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1 idx1 5 NULL 503 Using where; Using index; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1 idx1 5 NULL 503 Using where; Using index; Using temporary; Using filesort flush status; select b, count(*) num_cnt from t1 where a > 9750 group by b order by num_cnt limit 1; @@ -2974,19 +2974,19 @@ INSERT INTO t2 VALUES (107, 7), (105, 1), (101, 3), (100, 7), (110, 1); EXPLAIN SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index -1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 8 Using index +1 SIMPLE t2 NULL ref i_a i_a 5 test.t1.a 2 Using index EXPLAIN SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 8; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index -1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 Using index +1 SIMPLE t2 NULL ref i_a i_a 5 test.t1.a 2 Using index EXPLAIN SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index -1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 8 Using index +1 SIMPLE t2 NULL ref i_a i_a 5 test.t1.a 2 Using index DROP TABLE t1,t2; # # MDEV-4974 memory leak in 5.5.32-MariaDB-1~wheezy-log @@ -3060,12 +3060,12 @@ LEFT JOIN ( t3 AS t3a, t3 AS t3b ) ON ( t3b.f3_key = t3a.f3 ) WHERE t3a.f3 < f1 OR t3b.f3 != f1 ) ORDER BY field; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 Using temporary; Using filesort -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t3a ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary -1 PRIMARY t3b ref f3_key f3_key 6 test.t3a.f3 1 100.00 Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 Using temporary; Using filesort +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t3a NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary +1 PRIMARY t3b NULL ref f3_key f3_key 6 test.t3a.f3 1 100.00 Using where; End temporary Warnings: Note 1003 select concat('foo',`test`.`t2`.`f2`) AS `field` from `test`.`t2` semi join ((`test`.`t3` `t3a` join `test`.`t3` `t3b`)) where `test`.`t3a`.`f3` < 'foo' or `test`.`t3b`.`f3` <> 'foo' order by concat('foo',`test`.`t2`.`f2`) DROP TABLE t1,t2,t3; @@ -3080,8 +3080,8 @@ insert into t1 select A.a + 10 * B.a + 100 * C.a, 1234 from t2 A, t2 B, t2 C; # Should show rows=2, not rows=100 explain update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range key1 key1 5 NULL 2 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 2 Using where; Using buffer drop table t1,t2; # # MDEV-465: Optimizer : wrong index choice, leading to strong performances issues @@ -3114,12 +3114,12 @@ INSERT INTO t2 (id2,id3,id4) VALUES (1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,0,1),(1,2 INSERT INTO t2 (id2,id3,id4) VALUES (1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,0,1),(1,2,1),(1,3,1); # The following two must both use id_23_date and no "using filesort": EXPLAIN SELECT id1 FROM t1 WHERE id2=1 AND id3=1 ORDER BY date DESC LIMIT 0,4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range id_234_date,id_23_date id_23_date 2 NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range id_234_date,id_23_date id_23_date 2 NULL 8 Using where # See above query EXPLAIN SELECT id1 FROM t2 WHERE id2=1 AND id3=1 ORDER BY date DESC LIMIT 0,4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range id_23_date,id_234_date id_23_date 2 NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range id_23_date,id_234_date id_23_date 2 NULL 8 Using where drop table t1,t2; # # MDEV-8989: ORDER BY optimizer ignores equality propagation @@ -3152,9 +3152,9 @@ insert into t3 select a+1000, 1000+a, 1000+a, repeat('abc-',50) from t1; explain select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b from t2, t3 where t2.a=t3.a order by t2.a limit 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index a a 5 NULL 5 Using where -1 SIMPLE t3 ref a a 5 test.t2.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index a a 5 NULL 5 Using where +1 SIMPLE t3 NULL ref a a 5 test.t2.a 1 # # This is Q2 which used to have "Using temporary; using filesort" but # has the same query plan as Q1: @@ -3162,9 +3162,9 @@ id select_type table type possible_keys key key_len ref rows Extra explain select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b from t2, t3 where t2.a=t3.a order by t3.a limit 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index a a 5 NULL 5 Using where -1 SIMPLE t3 ref a a 5 test.t2.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index a a 5 NULL 5 Using where +1 SIMPLE t3 NULL ref a a 5 test.t2.a 1 select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b from t2, t3 where t2.a=t3.a order by t2.a limit 5; pk a b pk a b @@ -3187,15 +3187,15 @@ pk a b pk a b explain select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b from t2, t3 where t2.a=t3.a order by t2.a limit 25; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL a NULL NULL NULL 200 Using where; Using filesort -1 SIMPLE t3 ref a a 5 test.t2.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 200 Using where; Using filesort +1 SIMPLE t3 NULL ref a a 5 test.t2.a 1 explain select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b from t2, t3 where t2.a=t3.a order by t3.a limit 25; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL a NULL NULL NULL 200 Using where; Using filesort -1 SIMPLE t3 ref a a 5 test.t2.a 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 200 Using where; Using filesort +1 SIMPLE t3 NULL ref a a 5 test.t2.a 1 select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b from t2, t3 where t2.a=t3.a order by t2.a limit 25; pk a b pk a b @@ -3257,12 +3257,12 @@ pk a b pk a b # "Using temporary" is not invoked) # explain select * from t3 where b=a order by a limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index NULL a 5 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL index NULL a 5 NULL 10 Using where # This must not use filesort. The query plan should be like the query above: explain select * from t3 where b=a order by b limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index NULL a 5 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL index NULL a 5 NULL 10 Using where drop table t0,t1,t2,t3; set @@optimizer_switch=@tmp_8989; set optimizer_switch='orderby_uses_equalities=on'; @@ -3448,9 +3448,9 @@ CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b)); INSERT INTO t1 VALUES (0, 1),(1, 2); CREATE TABLE t2 SELECT * FROM t1; EXPLAIN SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t1 index PRIMARY b 5 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY t1 NULL index PRIMARY b 5 NULL 1 Using where SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2; c 1 @@ -3497,10 +3497,10 @@ WHERE wings.id IN ( SELECT books.wings_id FROM books WHERE books.library_id = 8663 AND books.scheduled_for_removal=0 ) ORDER BY wings.id; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2 100.00 Using filesort -1 PRIMARY wings eq_ref PRIMARY PRIMARY 4 test.books.wings_id 1 100.00 -2 MATERIALIZED books ref library_idx library_idx 4 const 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 100.00 Using filesort +1 PRIMARY wings NULL eq_ref PRIMARY PRIMARY 4 test.books.wings_id 1 100.00 +2 MATERIALIZED books NULL ref library_idx library_idx 4 const 2 100.00 Using where Warnings: Note 1003 select `test`.`wings`.`id` AS `wing_id`,`test`.`wings`.`department_id` AS `department_id` from `test`.`wings` semi join (`test`.`books`) where `test`.`books`.`library_id` = 8663 and `test`.`books`.`scheduled_for_removal` = 0 and `test`.`wings`.`id` = `test`.`books`.`wings_id` order by `test`.`wings`.`id` set optimizer_switch= @save_optimizer_switch; @@ -3546,9 +3546,9 @@ DROP TABLE t1; create table t1 (a int); insert into t1 values (3), (7), (1); explain (select a from t1 limit 2) order by a desc; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using filesort -2 DERIVED t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 (select a from t1 limit 2) order by a desc; a 7 @@ -3556,9 +3556,9 @@ a create table t2 (a int, b int); insert into t2 values (3,70), (7,10), (1,40), (4,30); explain (select b,a from t2 order by a limit 3) order by b desc; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using filesort -2 DERIVED t2 ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 Using filesort +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 4 Using filesort (select b,a from t2 order by a limit 3) order by b desc; b a 70 3 @@ -3616,9 +3616,9 @@ ORDER BY t2.key2 ASC LIMIT 1) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 -2 DEPENDENT SUBQUERY t2 ref key1 key1 5 test.t1.a 10 Using index condition; Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 +2 DEPENDENT SUBQUERY t2 NULL ref key1 key1 5 test.t1.a 10 Using index condition; Using where; Using filesort select (SELECT concat(id, '-', key1, '-', col1) FROM t2 @@ -3677,8 +3677,8 @@ test.t4 analyze status Table is already up to date # rows must be around 1200, not 600: explain extended select * from t4 where b < 5000 order by a limit 600; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t4 index NULL a 5 NULL 1188 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL index NULL a 5 NULL 1188 100.00 Using where Warnings: Note 1003 select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`filler1` AS `filler1`,`test`.`t4`.`filler2` AS `filler2` from `test`.`t4` where `test`.`t4`.`b` < 5000 order by `test`.`t4`.`a` limit 600 set histogram_size=@tmp_h, histogram_type=@tmp_ht, use_stat_tables=@tmp_u, @@ -4366,10 +4366,10 @@ EXPLAIN SELECT t1.a FROM t1 WHERE t1.a IN (SELECT a FROM t2 WHERE b=3) ORDER BY t1.a DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 Using filesort -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 Using index -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 3 Using filesort +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 Using index +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 Using where EXPLAIN FORMAT=JSON SELECT t1.a FROM t1 WHERE t1.a IN (SELECT a FROM t2 WHERE b=3) @@ -4439,10 +4439,10 @@ EXPLAIN SELECT t1.a, group_concat(t1.b) FROM t1 WHERE t1.a IN (SELECT a FROM t2 WHERE b=3) GROUP BY t1.a DESC; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 Using filesort -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 3 Using filesort +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 Using where EXPLAIN FORMAT=JSON SELECT t1.a, group_concat(t1.b) FROM t1 WHERE t1.a IN (SELECT a FROM t2 WHERE b=3) @@ -4516,11 +4516,11 @@ create table t1 (a int, b int, c int, key r (a desc, b asc)); insert t1 select seq % 10, seq div 10, seq from seq_1_to_55; insert t1 values (NULL, NULL, NULL), (9, NULL, NULL); explain select * from t1 force index(r) order by a,b limit 20; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 57 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 57 Using filesort explain select * from t1 force index(r) order by a desc,b limit 20; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL r 10 NULL 20 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL r 10 NULL 20 select * from t1 force index(r) order by a desc,b limit 20; a b c 9 NULL NULL diff --git a/mysql-test/main/order_by.test b/mysql-test/main/order_by.test index 5ff1dc4ad3b..955f67284db 100644 --- a/mysql-test/main/order_by.test +++ b/mysql-test/main/order_by.test @@ -908,7 +908,7 @@ SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; # part 2 of the problem : DESC test cases --echo # Must use ref-or-null on the a_c index ---replace_column 1 x 2 x 3 x 6 x 7 x 8 x 9 x 10 x +--replace_column 1 x 2 x 3 x 4 x 7 x 8 x 9 x 10 x 11 x EXPLAIN SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC; --echo # Must return 1 row diff --git a/mysql-test/main/order_by_innodb.result b/mysql-test/main/order_by_innodb.result index 830377f35a3..7faeefdf327 100644 --- a/mysql-test/main/order_by_innodb.result +++ b/mysql-test/main/order_by_innodb.result @@ -39,14 +39,14 @@ select * from t1 where key1<3 or key2<3 order by pk; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where; Using filesort explain select * from t1 where key1<3 or key2<3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where drop table t0, t1; # # MDEV-18094: Query with order by limit picking index scan over filesort @@ -63,15 +63,15 @@ KEY a_b (a,b) insert into t1 select A.a , B.a, C.a from t0 A, t0 B, t0 C; # should use ref access explain select a,b,c from t1 where a=1 and c=2 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a_c,a_b a_c 10 const,const 20 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a_c,a_b a_c 10 const,const 20 Using where; Using filesort # both should use range access explain select a,b,c from t1 where a=1 and c=2 order by b limit 1000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a_c,a_b a_b 5 NULL 200 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a_c,a_b a_b 5 NULL 200 Using where explain select a,b,c from t1 where a=1 and c=2 order by b limit 2000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a_c,a_b a_b 5 NULL 200 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a_c,a_b a_b 5 NULL 200 Using where drop table t1,t0; # Start of 10.2 tests # @@ -247,10 +247,10 @@ d1 > '2019-02-06 00:00:00' order by dd.d1, dd.d2, dd.id limit 1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index -1 PRIMARY t2 eq_ref PRIMARY,id2 PRIMARY 4 func # Using where -2 DEPENDENT SUBQUERY dd range id2,for_latest_sort for_latest_sort 6 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL # Using index +1 PRIMARY t2 NULL eq_ref PRIMARY,id2 PRIMARY 4 func # Using where +2 DEPENDENT SUBQUERY dd NULL range id2,for_latest_sort for_latest_sort 6 NULL # Using where drop table t1,t2,t3; # End of 10.2 tests # @@ -260,11 +260,11 @@ create table t1 (a int, b int, c int, key r (a desc, b asc)); insert t1 select seq % 10, seq div 10, seq from seq_1_to_55; insert t1 values (NULL, NULL, NULL), (9, NULL, NULL); explain select * from t1 force index(r) order by a,b limit 20; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 57 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 57 Using filesort explain select * from t1 force index(r) order by a desc,b limit 20; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL r 10 NULL 20 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL r 10 NULL 20 select * from t1 force index(r) order by a desc,b limit 20; a b c 9 NULL NULL diff --git a/mysql-test/main/order_by_innodb.test b/mysql-test/main/order_by_innodb.test index 19bd1e3007a..d6ee16300fb 100644 --- a/mysql-test/main/order_by_innodb.test +++ b/mysql-test/main/order_by_innodb.test @@ -48,14 +48,14 @@ from t0 A, t0 B, t0 C, t0 D; --echo # The following must NOT use 'index' on PK. --echo # It should use index_merge(key1,key2) + filesort ---replace_column 9 # +--replace_column 10 # explain select * from t1 where key1<3 or key2<3 order by pk; ---replace_column 9 # +--replace_column 10 # explain select * from t1 @@ -224,7 +224,7 @@ from --echo # This must NOT have "Range checked for each record" without any --echo # provisions to produce rows in the required ordering: ---replace_column 9 # +--replace_column 10 # explain select t1.id,t2.id diff --git a/mysql-test/main/order_by_optimizer.result b/mysql-test/main/order_by_optimizer.result index 8f128552a86..62ed3a51e12 100644 --- a/mysql-test/main/order_by_optimizer.result +++ b/mysql-test/main/order_by_optimizer.result @@ -13,8 +13,8 @@ alter table t2 add key2 int, add key(key2); # This must show "Using filesort": explain select * from t2 ignore index for order by (key1) where col1<0 order by key1 limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1010 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1010 Using where; Using filesort drop table t0, t1, t2; # # MDEV-8857: [Upstream too] EXPLAIN incorrectly shows Distinct for tables using join buffer @@ -24,7 +24,7 @@ insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t1 (a int, filler char(200), key(a)); insert into t1 select A.a + B.a* 10, 'AAAAAAAAAAAAAAAAAAAA' from t0 A, t0 B where B.a in (0,1); explain select distinct A.a from t0 A, t1 B where A.a+B.a> 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A ALL NULL NULL NULL NULL 10 Using temporary -1 SIMPLE B index NULL a 5 NULL 20 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 10 Using temporary +1 SIMPLE B NULL index NULL a 5 NULL 20 Using where; Using index; Using join buffer (flat, BNL join) drop table t0, t1; diff --git a/mysql-test/main/order_by_optimizer_innodb.result b/mysql-test/main/order_by_optimizer_innodb.result index cbb5551b7cf..6424109862e 100644 --- a/mysql-test/main/order_by_optimizer_innodb.result +++ b/mysql-test/main/order_by_optimizer_innodb.result @@ -40,12 +40,12 @@ pk1 count(*) 10 276 # The following should use range(ux_pk1_fd5), two key parts (key_len=5+8=13) EXPLAIN SELECT * FROM t2 USE INDEX(ux_pk1_fd5) WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range ux_pk1_fd5 ux_pk1_fd5 13 NULL 138 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range ux_pk1_fd5 ux_pk1_fd5 13 NULL 138 Using where # This also must use range, not ref. key_len must be 13 EXPLAIN SELECT * FROM t2 WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY,ux_pk1_fd5 ux_pk1_fd5 13 NULL 138 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range PRIMARY,ux_pk1_fd5 ux_pk1_fd5 13 NULL 138 Using where drop table t0,t1, t2; # # MDEV-6814: Server crashes in calculate_key_len on query with ORDER BY @@ -87,14 +87,14 @@ FROM t1 USE INDEX(key1) WHERE pk1 = 123 AND col1 = 'video' ORDER BY pk2 DESC LIMIT 21; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref key1 key1 55 const,const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref key1 key1 55 const,const 1 Using where; Using index # this must not use filesort, either: explain SELECT pk2 FROM t2 USE INDEX(key1) WHERE pk1 = 123 AND col1 = 'video' ORDER BY pk2 DESC LIMIT 21; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref key1 key1 55 const,const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref key1 key1 55 const,const 1 Using where; Using index drop table t1, t2; SET GLOBAL innodb_stats_persistent=@save_stats_persistent; diff --git a/mysql-test/main/order_by_zerolength-4285.result b/mysql-test/main/order_by_zerolength-4285.result index 95b4224f5a2..30d373cac7d 100644 --- a/mysql-test/main/order_by_zerolength-4285.result +++ b/mysql-test/main/order_by_zerolength-4285.result @@ -34,8 +34,8 @@ CREATE TABLE t1 (pk INT PRIMARY KEY); INSERT INTO t1 VALUES (1),(2); explain SELECT * FROM t1 ORDER BY 'foo', CONVERT(pk, CHAR(0)) LIMIT 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 Using index; Using filesort SELECT * FROM t1 ORDER BY 'foo', Cast(pk as CHAR(0)) LIMIT 2; pk 1 diff --git a/mysql-test/main/outfile.result b/mysql-test/main/outfile.result index 4c439c37e4d..0fa58ea0a2a 100644 Binary files a/mysql-test/main/outfile.result and b/mysql-test/main/outfile.result differ diff --git a/mysql-test/main/parser.result b/mysql-test/main/parser.result index 6a24e435878..e3c9c498cd9 100644 --- a/mysql-test/main/parser.result +++ b/mysql-test/main/parser.result @@ -2148,13 +2148,13 @@ ERROR 42S02: Table 'test.t' doesn't exist create table t1 (x int); insert into t1 values (1),(2); explain extended (SELECT x FROM t1 WINDOW w1 as () FOR UPDATE) LIMIT 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 (select `test`.`t1`.`x` AS `x` from `test`.`t1` limit 1) explain extended (SELECT x FROM t1 FOR UPDATE) LIMIT 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 (select `test`.`t1`.`x` AS `x` from `test`.`t1` limit 1) drop table t1; diff --git a/mysql-test/main/partition.result b/mysql-test/main/partition.result index a5d84072d11..a1c526896e6 100644 --- a/mysql-test/main/partition.result +++ b/mysql-test/main/partition.result @@ -74,8 +74,8 @@ ENGINE=MyISAM PARTITION BY KEY (a) PARTITIONS 1; INSERT INTO t1 VALUES ('a'),('b'),('c'); EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a > 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select 1 AS `1` from `test`.`t1` where `test`.`t1`.`a` > 1 DROP TABLE t1; @@ -2360,12 +2360,12 @@ b c 1 15 EXPLAIN SELECT b, c FROM t1 WHERE b = 1 GROUP BY b, c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range bc bc 10 NULL 8 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2 range bc bc 10 NULL 8 Using where; Using index for group-by EXPLAIN SELECT b, c FROM t1 WHERE b = 1 or b=2 GROUP BY b, c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range bc bc 10 NULL 8 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2 range bc bc 10 NULL 8 Using where; Using index for group-by DROP TABLE t1; # # Bug #45807: crash accessing partitioned table and sql_mode @@ -2682,32 +2682,32 @@ set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectiv # Tests using stats provided by the storage engine # explain extended select * from t2 where part_key=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 200 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p1 ALL NULL NULL NULL NULL 200 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` = 1 explain partitions select * from t2 where part_key=1; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p1 ALL NULL NULL NULL NULL 200 Using where explain extended select * from t2 where part_key in (1,2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 400 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p1,p2 ALL NULL NULL NULL NULL 400 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` in (1,2) explain partitions select * from t2 where part_key in (1,2); id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p1,p2 ALL NULL NULL NULL NULL 400 Using where explain extended select * from t2 where b=5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1000 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 5 explain partitions select * from t2 where b=5; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1000 Using where explain extended select * from t2 partition(p0) where b=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 200 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 200 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` PARTITION (`p0`) where `test`.`t2`.`b` = 1 set @save_histogram_size=@@histogram_size; @@ -2723,8 +2723,8 @@ test.t2 analyze status OK # # filtered should be 100 explain extended select * from t2 where part_key=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 200 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p1 ALL NULL NULL NULL NULL 200 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` = 1 explain partitions select * from t2 where part_key=1; @@ -2732,24 +2732,24 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p1 ALL NULL NULL NULL NULL 200 Using where # filtered should be 100 explain extended select * from t2 where part_key in (1,2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 400 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p1,p2 ALL NULL NULL NULL NULL 400 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` in (1,2) explain partitions select * from t2 where part_key in (1,2); id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p1,p2 ALL NULL NULL NULL NULL 400 Using where explain extended select * from t2 where b=5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 0.10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1000 0.10 Using where Warnings: Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 5 explain partitions select * from t2 where b=5; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1000 Using where explain extended select * from t2 partition(p0) where b=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 200 20.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 200 20.00 Using where Warnings: Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` PARTITION (`p0`) where `test`.`t2`.`b` = 1 set @@use_stat_tables= @save_use_stat_tables; diff --git a/mysql-test/main/partition_innodb.test b/mysql-test/main/partition_innodb.test index 26c7c0783f3..d7a569ec648 100644 --- a/mysql-test/main/partition_innodb.test +++ b/mysql-test/main/partition_innodb.test @@ -741,7 +741,7 @@ INSERT INTO `t1` VALUES (2,2,'2013-03-12 10:11:48'); SELECT * FROM t1 WHERE col1 = 1 AND col2 = 2 AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00' GROUP BY 1, 2, 3; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM t1 WHERE col1 = 1 AND col2 = 2 AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00' GROUP BY 1, 2, 3; @@ -783,7 +783,7 @@ insert into t1 select 10+A.a + 10*B.a + 100*C.a + 1000*D.a, from t2 A, t2 B, t2 C ,t2 D; # This should show index_merge, using intersect ---replace_column 9 # +--replace_column 10 # set statement optimizer_switch='rowid_filter=off' for explain select * from t1 where a=1 and b=2 and pk between 1 and 999999 ; # 794 rows in output diff --git a/mysql-test/main/partition_mrr_aria.result b/mysql-test/main/partition_mrr_aria.result index 99fb17338c3..760ade391f9 100644 --- a/mysql-test/main/partition_mrr_aria.result +++ b/mysql-test/main/partition_mrr_aria.result @@ -43,8 +43,8 @@ set @save_optimizer_switch=@@optimizer_switch; set optimizer_switch='mrr=on'; explain select * from t3 force index (key_col) where key_col < 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range key_col key_col 5 NULL # Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 p1,p2,p3 range key_col key_col 5 NULL # Using where; Rowid-ordered scan select * from t3 force index (key_col) where key_col < 3; ID part_id key_col col2 1 0 0 123456 @@ -128,9 +128,9 @@ test.t2 analyze status OK set join_cache_level=6; set optimizer_switch='mrr=on'; explain extended select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = t2.a-1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index -1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 2 100.00 Using where; Using index +1 SIMPLE t0 NULL ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t0` join `test`.`t2` where `test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` / 10 = `test`.`t2`.`a` - 1 select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = t2.a-1; @@ -145,9 +145,9 @@ tp a b c a 3 4 30 yzy 4 3 4 30 zzzyy 4 explain extended select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = t2.a-1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index -1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 2 100.00 Using where; Using index +1 SIMPLE t1 p1,p2,p3 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` / 10 = `test`.`t2`.`a` - 1 select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = t2.a-1; @@ -162,9 +162,9 @@ tp a b c a 3 4 30 yzy 4 3 4 30 zzzyy 4 explain extended select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index -1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using index condition; Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 2 100.00 Using where; Using index +1 SIMPLE t0 NULL ref idx idx 5 test.t2.a 12 100.00 Using index condition; Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t0` join `test`.`t2` where `test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` / 10 = 4 select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4; @@ -188,9 +188,9 @@ tp a b c a 2 3 40 yzxxx 3 2 4 40 xxzy 4 explain extended select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index -1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 2 100.00 Using where; Using index +1 SIMPLE t1 p1,p2,p3 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` / 10 = 4 select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4; @@ -220,17 +220,17 @@ Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain extended select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 4 100.00 Using where; Using index -1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 4 100.00 Using where; Using index +1 SIMPLE t0 NULL ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c` from `test`.`t2` left join `test`.`t0` on(`test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` is not null) where `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` is null select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null; a tp a b c explain extended select * from t2 left join t1 on t2.a=t1.a where t2.a in (3,4) and t1.b is null; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 4 100.00 Using where; Using index -1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 4 100.00 Using where; Using index +1 SIMPLE t1 p1,p2,p3 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t2` left join `test`.`t1` on(`test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` is not null) where `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` is null select * from t2 left join t1 on t2.a=t1.a where t2.a in (3,4) and t1.b is null; diff --git a/mysql-test/main/partition_mrr_innodb.result b/mysql-test/main/partition_mrr_innodb.result index 8e34914a6e3..ef4a4a5e207 100644 --- a/mysql-test/main/partition_mrr_innodb.result +++ b/mysql-test/main/partition_mrr_innodb.result @@ -43,8 +43,8 @@ set @save_optimizer_switch=@@optimizer_switch; set optimizer_switch='mrr=on'; explain select * from t3 force index (key_col) where key_col < 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range key_col key_col 5 NULL # Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 p1,p2,p3 range key_col key_col 5 NULL # Using where; Rowid-ordered scan select * from t3 force index (key_col) where key_col < 3; ID part_id key_col col2 1 0 0 123456 @@ -128,9 +128,9 @@ test.t2 analyze status OK set join_cache_level=6; set optimizer_switch='mrr=on'; explain extended select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = t2.a-1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index -1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 2 100.00 Using where; Using index +1 SIMPLE t0 NULL ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t0` join `test`.`t2` where `test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` / 10 = `test`.`t2`.`a` - 1 select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = t2.a-1; @@ -145,9 +145,9 @@ tp a b c a 3 4 30 yzy 4 3 4 30 zzzyy 4 explain extended select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = t2.a-1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index -1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 2 100.00 Using where; Using index +1 SIMPLE t1 p1,p2,p3 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` / 10 = `test`.`t2`.`a` - 1 select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = t2.a-1; @@ -162,9 +162,9 @@ tp a b c a 3 4 30 yzy 4 3 4 30 zzzyy 4 explain extended select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index -1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using index condition; Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 2 100.00 Using where; Using index +1 SIMPLE t0 NULL ref idx idx 5 test.t2.a 12 100.00 Using index condition; Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t0` join `test`.`t2` where `test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` / 10 = 4 select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4; @@ -188,9 +188,9 @@ tp a b c a 2 3 40 yzxxx 3 2 4 40 xxzy 4 explain extended select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index -1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 2 100.00 Using where; Using index +1 SIMPLE t1 p1,p2,p3 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` / 10 = 4 select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4; @@ -220,17 +220,17 @@ Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain extended select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 4 100.00 Using where; Using index -1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 4 100.00 Using where; Using index +1 SIMPLE t0 NULL ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c` from `test`.`t2` left join `test`.`t0` on(`test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` is not null) where `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` is null select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null; a tp a b c explain extended select * from t2 left join t1 on t2.a=t1.a where t2.a in (3,4) and t1.b is null; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 4 100.00 Using where; Using index -1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 4 100.00 Using where; Using index +1 SIMPLE t1 p1,p2,p3 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t2` left join `test`.`t1` on(`test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` is not null) where `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` is null select * from t2 left join t1 on t2.a=t1.a where t2.a in (3,4) and t1.b is null; diff --git a/mysql-test/main/partition_mrr_myisam.result b/mysql-test/main/partition_mrr_myisam.result index 395b64ffb11..474c2b62b01 100644 --- a/mysql-test/main/partition_mrr_myisam.result +++ b/mysql-test/main/partition_mrr_myisam.result @@ -43,8 +43,8 @@ set @save_optimizer_switch=@@optimizer_switch; set optimizer_switch='mrr=on'; explain select * from t3 force index (key_col) where key_col < 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range key_col key_col 5 NULL # Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 p1,p2,p3 range key_col key_col 5 NULL # Using where; Rowid-ordered scan select * from t3 force index (key_col) where key_col < 3; ID part_id key_col col2 1 0 0 123456 @@ -128,9 +128,9 @@ test.t2 analyze status OK set join_cache_level=6; set optimizer_switch='mrr=on'; explain extended select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = t2.a-1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index -1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 2 100.00 Using where; Using index +1 SIMPLE t0 NULL ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t0` join `test`.`t2` where `test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` / 10 = `test`.`t2`.`a` - 1 select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = t2.a-1; @@ -145,9 +145,9 @@ tp a b c a 3 4 30 yzy 4 3 4 30 zzzyy 4 explain extended select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = t2.a-1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index -1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 2 100.00 Using where; Using index +1 SIMPLE t1 p1,p2,p3 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` / 10 = `test`.`t2`.`a` - 1 select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = t2.a-1; @@ -162,9 +162,9 @@ tp a b c a 3 4 30 yzy 4 3 4 30 zzzyy 4 explain extended select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index -1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using index condition; Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 2 100.00 Using where; Using index +1 SIMPLE t0 NULL ref idx idx 5 test.t2.a 12 100.00 Using index condition; Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t0` join `test`.`t2` where `test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` / 10 = 4 select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4; @@ -188,9 +188,9 @@ tp a b c a 2 3 40 yzxxx 3 2 4 40 xxzy 4 explain extended select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index -1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 2 100.00 Using where; Using index +1 SIMPLE t1 p1,p2,p3 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` / 10 = 4 select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4; @@ -220,17 +220,17 @@ Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain extended select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 4 100.00 Using where; Using index -1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 4 100.00 Using where; Using index +1 SIMPLE t0 NULL ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c` from `test`.`t2` left join `test`.`t0` on(`test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` is not null) where `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` is null select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null; a tp a b c explain extended select * from t2 left join t1 on t2.a=t1.a where t2.a in (3,4) and t1.b is null; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range idx idx 5 NULL 4 100.00 Using where; Using index -1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 4 100.00 Using where; Using index +1 SIMPLE t1 p1,p2,p3 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t2` left join `test`.`t1` on(`test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` is not null) where `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` is null select * from t2 left join t1 on t2.a=t1.a where t2.a in (3,4) and t1.b is null; @@ -286,14 +286,14 @@ set @tmp1=@@join_cache_level, @tmp2=@@optimizer_switch; set join_cache_level=6, optimizer_switch='mrr=on'; explain select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx idx 5 NULL 2 Using where; Using index -1 SIMPLE t0 ref idx idx 5 test.t2.a 12 Using index condition; Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 2 Using where; Using index +1 SIMPLE t0 NULL ref idx idx 5 test.t2.a 12 Using index condition; Using join buffer (flat, BKA join); Rowid-ordered scan # This will use "Using index condition(BKA)" explain select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx idx 5 NULL 2 Using where; Using index -1 SIMPLE t1 ref idx idx 5 test.t2.a 12 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 2 Using where; Using index +1 SIMPLE t1 p1,p2,p3 ref idx idx 5 test.t2.a 12 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan set join_cache_level=@tmp1, optimizer_switch=@tmp2; drop table t0,t1,t2; diff --git a/mysql-test/main/partition_order.result b/mysql-test/main/partition_order.result index d4a0c133d10..2c01ac034ea 100644 --- a/mysql-test/main/partition_order.result +++ b/mysql-test/main/partition_order.result @@ -788,8 +788,8 @@ drop table t1; create table t1 (a int, b int, key(a desc)) partition by hash(a) partitions 4; insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6); explain select * from t1 order by a limit 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2,p3 index NULL a 5 NULL 3 select * from t1 order by a limit 3; a b 1 1 diff --git a/mysql-test/main/partition_pruning.result b/mysql-test/main/partition_pruning.result index 519bf590b9b..841c24f474f 100644 --- a/mysql-test/main/partition_pruning.result +++ b/mysql-test/main/partition_pruning.result @@ -2254,8 +2254,8 @@ DROP TABLE t1; create table t1 ( a int not null) partition by hash(a) partitions 2; insert into t1 values (1),(2),(3); explain select * from t1 where a=5 and a=6; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE drop table t1; create table t1 ( a int(11) not null @@ -2871,64 +2871,64 @@ explain partitions select * from t2 where b = 4; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 77 explain extended select * from t2 where b = 6; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref b b 5 const 77 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 77 100.00 Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 6 explain partitions select * from t2 where b = 6; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ref b b 5 const 77 explain extended select * from t2 where b in (1,3,5); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 40.66 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 40.66 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (1,3,5) explain partitions select * from t2 where b in (1,3,5); id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b in (2,4,6); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 25.38 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 25.38 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (2,4,6) explain partitions select * from t2 where b in (2,4,6); id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b in (7,8,9); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 36.81 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 36.81 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` in (7,8,9) explain partitions select * from t2 where b in (7,8,9); id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b > 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 44.62 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 44.62 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 explain partitions select * from t2 where b > 5; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b > 5 and b < 8; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 22.20 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 22.20 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 8 explain partitions select * from t2 where b > 5 and b < 8; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 Using where explain extended select * from t2 where b > 5 and b < 7; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range b b 5 NULL 77 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p1,p2,p3,p4 range b b 5 NULL 77 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 5 and `test`.`t2`.`b` < 7 explain partitions select * from t2 where b > 5 and b < 7; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1,p2,p3,p4 range b b 5 NULL 77 Using where explain extended select * from t2 where b > 0 and b < 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 910 41.87 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p1,p2,p3,p4 ALL b NULL NULL NULL 910 41.87 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` > 0 and `test`.`t2`.`b` < 5 explain partitions select * from t2 where b > 0 and b < 5; diff --git a/mysql-test/main/partition_range.result b/mysql-test/main/partition_range.result index 7384def5c85..91b4f81afcb 100644 --- a/mysql-test/main/partition_range.result +++ b/mysql-test/main/partition_range.result @@ -5,22 +5,22 @@ drop table if exists t1, t2; CREATE TABLE t1 (a INT,b INT,KEY a (a,b)); INSERT INTO `t1` VALUES (0,580092),(3000,894076),(4000,805483),(4000,913540),(6000,611137),(8000,171602),(9000,599495),(9000,746305),(10000,272829),(10000,847519),(12000,258869),(12000,929028),(13000,288970),(15000,20971),(15000,105839),(16000,788272),(17000,76914),(18000,827274),(19000,802258),(20000,123677),(20000,587729),(22000,701449),(25000,31565),(25000,230782),(25000,442887),(25000,733139),(25000,851020); EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10000, 1000000, 3000) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 1 Using where; Using index for group-by alter table t1 partition by hash(a) partitions 1; EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10000, 1000000, 3000) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0 range a a 5 NULL 1 Using where; Using index for group-by alter table t1 remove partitioning; insert into t1 (a,b) select seq,seq from seq_4001_to_4100; insert into t1 (a,b) select seq,seq from seq_10001_to_10100; EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10000, 1000000, 3000) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 4 Using where; Using index alter table t1 partition by hash(a) partitions 1; EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10000, 1000000, 3000) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0 range a a 5 NULL 4 Using where; Using index DROP TABLE t1; create table t1 (a DATETIME) partition by range (TO_DAYS(a)) @@ -975,11 +975,11 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date # plans should be identical EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0 range a a 5 NULL 2 Using where; Using index EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 5 NULL 2 Using where; Using index FLUSH status; SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a; a MAX(b) diff --git a/mysql-test/main/pool_of_threads.result b/mysql-test/main/pool_of_threads.result index 91ad7ab098f..8f4355a2aa6 100644 --- a/mysql-test/main/pool_of_threads.result +++ b/mysql-test/main/pool_of_threads.result @@ -128,20 +128,20 @@ fld3 select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%'; fld3 explain select t2.fld3 from t2 where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3,not_used); ERROR 42000: Key 'not_used' doesn't exist in table 't2' explain select fld3 from t2 use index (not_used); @@ -151,8 +151,8 @@ fld3 honeysuckle honoring explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld3 fld3 30 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 Using where; Using index select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3; fld1 fld3 148504 Colombo @@ -171,8 +171,8 @@ fld1 250501 250502 explain select fld1 from t2 where fld1=250501 or fld1="250502"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld1 fld1 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 Using where; Using index select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502; fld1 250501 @@ -180,8 +180,8 @@ fld1 250505 250601 explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 Using where; Using index select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; fld1 fld3 012001 flanking @@ -597,21 +597,21 @@ companynr rtrim(space(512+companynr)) select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3; fld3 explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort -1 SIMPLE t3 ref period period 4 test.t1.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index period period 4 NULL 1 -1 SIMPLE t1 ref period period 4 test.t3.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL index period period 4 NULL 1 +1 SIMPLE t1 NULL ref period period 4 test.t3.period 4181 explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index period period 4 NULL 1 -1 SIMPLE t3 ref period period 4 test.t1.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index period period 4 NULL 1 +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 select period from t1; period 9410 @@ -624,9 +624,9 @@ select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3. fld3 period breaking 1001 explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const fld1 fld1 4 const 1 -1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const fld1 fld1 4 const 1 +1 SIMPLE t3 NULL const PRIMARY,period PRIMARY 4 const 1 select fld3,period from t2,t1 where companynr*10 = 37*10; fld3 period breaking 9410 @@ -1360,82 +1360,82 @@ select count(*) from t2 left join t4 using (companynr) where t4.companynr is not count(*) 1199 explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 Using where; Not exists select companynr,companyname from t2 left join t4 using (companynr) where companynr is null; companynr companyname select count(*) from t2 left join t4 using (companynr) where companynr is not null; count(*) 1200 explain select companynr,companyname from t2 left join t4 using (companynr) where companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE delete from t2 where fld1=999999; explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where SET @@optimizer_switch=@local_optimizer_switch; select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; companynr companynr 37 36 41 40 explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL index NULL PRIMARY 1 NULL 12 Using index; Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join) SET @@join_cache_level=@local_join_cache_level; select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008; fld1 companynr fld3 period @@ -1509,8 +1509,8 @@ select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069 explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>""; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; @@ -1950,11 +1950,11 @@ select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = fld1 sum(price) 038008 234298 explain select fld3 from t2 where 1>2 or 2>3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select fld3 from t2 where fld1=fld1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502; companynr fld1 34 250501 @@ -2005,8 +2005,8 @@ select count(*) from t3 where companynr=512 and price2=76234234; count(*) 4181 explain select min(fld1),max(fld1),count(*) from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(fld1),max(fld1),count(*) from t2; min(fld1) max(fld1) count(*) 0 1232609 1199 diff --git a/mysql-test/main/precedence_bugs.result b/mysql-test/main/precedence_bugs.result index 4b13e820d7f..a78cab1cdeb 100644 --- a/mysql-test/main/precedence_bugs.result +++ b/mysql-test/main/precedence_bugs.result @@ -15,8 +15,8 @@ drop table t1; # MDEV-13673 Bad result in view # explain extended select (3-2)+1, (3/2)*1, 3-(2+1), 3/(2*1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 3 - 2 + 1 AS `(3-2)+1`,3 / 2 * 1 AS `(3/2)*1`,3 - (2 + 1) AS `3-(2+1)`,3 / (2 * 1) AS `3/(2*1)` # diff --git a/mysql-test/main/processlist_notembedded.result b/mysql-test/main/processlist_notembedded.result index 26f6e4f9247..65df881669d 100644 --- a/mysql-test/main/processlist_notembedded.result +++ b/mysql-test/main/processlist_notembedded.result @@ -23,8 +23,8 @@ connect con1,localhost,root; select sleep(100000); connection default; SHOW EXPLAIN FOR $con_id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select sleep(100000) KILL QUERY $con_id; diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result index cd01a8949bd..6a734670010 100644 --- a/mysql-test/main/ps.result +++ b/mysql-test/main/ps.result @@ -158,29 +158,29 @@ set optimizer_switch='derived_merge=off,derived_with_keys=off'; set @stmt= ' explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25 ' ; prepare stmt1 from @stmt ; execute stmt1 ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +6 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables execute stmt1 ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +6 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +6 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables deallocate prepare stmt1; set optimizer_switch=@tmp_optimizer_switch; drop tables t1,t2; @@ -333,16 +333,16 @@ prepare stmt from "explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?"; set @v=5; execute stmt using @v; -id select_type table type possible_keys key key_len ref rows Extra -- - - - - - - - NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +- - - - - - - - - NULL Impossible WHERE set @v=0; execute stmt using @v; -id select_type table type possible_keys key key_len ref rows Extra -- - - - - - - - 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +- - - - - - - - - 4 Using where set @v=5; execute stmt using @v; -id select_type table type possible_keys key key_len ref rows Extra -- - - - - - - - NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +- - - - - - - - - NULL Impossible WHERE drop table t1; deallocate prepare stmt; create table t1 (a int); @@ -3061,15 +3061,15 @@ SET @save_optimizer_switch=@@optimizer_switch; SET optimizer_switch='outer_join_with_cache=off'; PREPARE stmt FROM 'EXPLAIN EXTENDED SELECT 1 FROM t1 RIGHT JOIN t1 t2 ON 1'; EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select 1 AS `1` from `test`.`t1` `t2` left join `test`.`t1` on(1) where 1 EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select 1 AS `1` from `test`.`t1` `t2` left join `test`.`t1` on(1) where 1 DEALLOCATE PREPARE stmt; @@ -3084,13 +3084,13 @@ PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 WHERE (SELECT (SELECT 1 FROM t1 GROU Warnings: Note 1249 Select 2 was reduced during optimization EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort DEALLOCATE PREPARE stmt; DROP TABLE t1; @@ -4160,15 +4160,15 @@ prepare stmt1 from "explain extended select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'"; execute stmt1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ref idx idx 6 const 1 100.00 Using index condition -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref idx idx 6 const 1 100.00 Using index condition +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`c` = 'foo' execute stmt1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ref idx idx 6 const 1 100.00 Using index condition -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref idx idx 6 const 1 100.00 Using index condition +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`c` = 'foo' deallocate prepare stmt1; @@ -4209,15 +4209,15 @@ prepare stmt2 from "explain extended select * from t1 where (1, 2) in ( select 3, 4 )"; execute stmt2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 0 execute stmt2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 0 deallocate prepare stmt2; @@ -4494,13 +4494,13 @@ CREATE TABLE t1 (a INT); CREATE TABLE t2 (b INT); PREPARE stmt FROM 'EXPLAIN UPDATE t1, t2 SET a = 1'; EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 Const row not found EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 Const row not found deallocate prepare stmt; DROP TABLE t1, t2; # @@ -5114,8 +5114,8 @@ DROP TABLE t1; # The output of this query in 'Note' is a syntactically incorrect query. # But as it's never logged, it's ok. It should be human readable only. EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING DEFAULT; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select default AS `?` CREATE TABLE t1 (a INT); @@ -5275,28 +5275,28 @@ DROP PROCEDURE p1; # MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler # EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 1 AS `1` limit 10 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 1 AS `1` limit 10 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1e0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 1 AS `1` limit 10 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING '10'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 1 AS `1` limit 10 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING TIME'10:10:10'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select 1 AS `1` limit 101010 EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 1 AS a,? AS b' USING 1; @@ -5496,15 +5496,15 @@ DROP TABLE t1; CREATE TABLE t1(c1 CHAR(255) PRIMARY KEY); PREPARE stmt FROM 'EXPLAIN DELETE b FROM t1 AS a JOIN t1 AS b'; EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE a system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE b system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE a NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE b NULL system NULL NULL NULL NULL 0 Const row not found DROP TABLE t1; CREATE TABLE t1(a INT); PREPARE stmt FROM 'EXPLAIN DELETE FROM t1.* USING t1'; EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found DEALLOCATE PREPARE stmt; DROP TABLE t1; # @@ -5515,9 +5515,9 @@ CREATE TABLE t1 (c int); CREATE TABLE t2 (d int); # EXPLAIN EXTENDED in regular way (not PS mode) EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select (/* select#2 */ select 1 from `test`.`t2` where 0) AS `(SELECT 1 FROM t2 WHERE d = c)` from `test`.`t1` @@ -5532,9 +5532,9 @@ PREPARE stmt FROM "EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) FROM t Warnings: Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1 EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select (/* select#2 */ select 1 from `test`.`t2` where 0) AS `(SELECT 1 FROM t2 WHERE d = c)` from `test`.`t1` @@ -5553,14 +5553,14 @@ CREATE TABLE t1 (c1 INT KEY) ENGINE=MyISAM; CREATE TABLE t2 (c2 INT) ENGINE=MyISAM; CREATE TABLE t3 (c3 INT) ENGINE=MyISAM; EXPLAIN EXTENDED UPDATE t3 SET c3 = ( SELECT COUNT(d1.c1) FROM ( SELECT a11.c1 FROM t1 AS a11 STRAIGHT_JOIN t2 AS a21 ON a21.c2 = a11.c1 JOIN t1 AS a12 ON a12.c1 = a11.c1 ) d1 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 0 100.00 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 0 100.00 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables PREPARE stmt FROM "EXPLAIN EXTENDED UPDATE t3 SET c3 = ( SELECT COUNT(d1.c1) FROM ( SELECT a11.c1 FROM t1 AS a11 STRAIGHT_JOIN t2 AS a21 ON a21.c2 = a11.c1 JOIN t1 AS a12 ON a12.c1 = a11.c1 ) d1 )"; EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 0 100.00 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 0 100.00 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DEALLOCATE PREPARE stmt; DROP TABLE t1, t2, t3; # diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test index c4ec92540a2..cf06ac54123 100644 --- a/mysql-test/main/ps.test +++ b/mysql-test/main/ps.test @@ -378,13 +378,13 @@ insert into t1 (a, b) values (1,1), (1,2), (2,1), (2,2); prepare stmt from "explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?"; set @v=5; ---replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - +--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - execute stmt using @v; set @v=0; ---replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - +--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - execute stmt using @v; set @v=5; ---replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - +--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - execute stmt using @v; drop table t1; deallocate prepare stmt; diff --git a/mysql-test/main/ps_11bugs.result b/mysql-test/main/ps_11bugs.result index 3bc7039583b..263816b74f6 100644 --- a/mysql-test/main/ps_11bugs.result +++ b/mysql-test/main/ps_11bugs.result @@ -119,11 +119,11 @@ drop table t1, t2; create table t1 (a int primary key); insert into t1 values (1); explain select * from t1 where 3 in (select (1+1) union select 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL select * from t1 where 3 in (select (1+1) union select 1); a prepare st_18492 from 'select * from t1 where 3 in (select (1+1) union select 1)'; diff --git a/mysql-test/main/ps_1general.result b/mysql-test/main/ps_1general.result index 05a40f54a52..95a488da34c 100644 --- a/mysql-test/main/ps_1general.result +++ b/mysql-test/main/ps_1general.result @@ -441,6 +441,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def id 8 3 1 Y 32928 0 63 def select_type 253 19 6 N 1 39 8 def table 253 64 2 Y 0 39 8 +def partitions 250 6316032 0 Y 0 39 8 def type 253 10 3 Y 0 39 8 def possible_keys 253 4_OR_8_K 0 Y 0 39 8 def key 253 64 0 Y 0 39 8 @@ -448,8 +449,8 @@ def key_len 253 4_OR_8_K 0 Y 0 39 8 def ref 253 2048 0 Y 0 39 8 def rows 253 64 1 Y 0 39 8 def Extra 253 255 14 N 1 39 8 -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using filesort SET @arg00=1 ; prepare stmt1 from ' explain select a from t1 where a > ? order by b '; execute stmt1 using @arg00; @@ -457,6 +458,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def id 8 3 1 Y 32928 0 63 def select_type 253 19 6 N 1 39 8 def table 253 64 2 Y 0 39 8 +def partitions 250 6316032 0 Y 0 39 8 def type 253 10 5 Y 0 39 8 def possible_keys 253 4_OR_8_K 7 Y 0 39 8 def key 253 64 7 Y 0 39 8 @@ -464,8 +466,8 @@ def key_len 253 4_OR_8_K 1 Y 0 39 8 def ref 253 2048 0 Y 0 39 8 def rows 253 64 1 Y 0 39 8 def Extra 253 255 37 N 1 39 8 -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 Using index condition; Using filesort drop table if exists t2; create table t2 (id smallint, name varchar(20)) ; prepare stmt1 from ' insert into t2 values(?, ?) ' ; diff --git a/mysql-test/main/ps_2myisam.result b/mysql-test/main/ps_2myisam.result index c85abaad051..95b8d79e84a 100644 --- a/mysql-test/main/ps_2myisam.result +++ b/mysql-test/main/ps_2myisam.result @@ -1156,6 +1156,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def id 8 3 1 Y 32928 0 63 def select_type 253 19 6 N 1 39 8 def table 253 64 2 Y 0 39 8 +def partitions 250 6316032 0 Y 0 39 8 def type 253 10 3 Y 0 39 8 def possible_keys 253 4_OR_8_K 0 Y 0 39 8 def key 253 64 0 Y 0 39 8 @@ -1163,8 +1164,8 @@ def key_len 253 4_OR_8_K 0 Y 0 39 8 def ref 253 2048 0 Y 0 39 8 def rows 253 64 1 Y 0 39 8 def Extra 253 255 0 N 1 39 8 -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t9 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 drop table if exists t2 ; create table t2 (s varchar(25), fulltext(s)) ENGINE = 'MYISAM' ; diff --git a/mysql-test/main/ps_3innodb.result b/mysql-test/main/ps_3innodb.result index 53f736f41a3..5b1d60ed1f9 100644 --- a/mysql-test/main/ps_3innodb.result +++ b/mysql-test/main/ps_3innodb.result @@ -1156,6 +1156,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def id 8 3 1 Y 32928 0 63 def select_type 253 19 6 N 1 39 8 def table 253 64 2 Y 0 39 8 +def partitions 250 6316032 0 Y 0 39 8 def type 253 10 3 Y 0 39 8 def possible_keys 253 4_OR_8_K 0 Y 0 39 8 def key 253 64 0 Y 0 39 8 @@ -1163,8 +1164,8 @@ def key_len 253 4_OR_8_K 0 Y 0 39 8 def ref 253 2048 0 Y 0 39 8 def rows 253 64 1 Y 0 39 8 def Extra 253 255 0 N 1 39 8 -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t9 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 test_sequence ------ delete tests ------ delete from t1 ; diff --git a/mysql-test/main/ps_4heap.result b/mysql-test/main/ps_4heap.result index 0cf1ed13cba..e70e8f0fa34 100644 --- a/mysql-test/main/ps_4heap.result +++ b/mysql-test/main/ps_4heap.result @@ -1157,6 +1157,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def id 8 3 1 Y 32928 0 63 def select_type 253 19 6 N 1 39 8 def table 253 64 2 Y 0 39 8 +def partitions 250 6316032 0 Y 0 39 8 def type 253 10 3 Y 0 39 8 def possible_keys 253 4_OR_8_K 0 Y 0 39 8 def key 253 64 0 Y 0 39 8 @@ -1164,8 +1165,8 @@ def key_len 253 4_OR_8_K 0 Y 0 39 8 def ref 253 2048 0 Y 0 39 8 def rows 253 64 1 Y 0 39 8 def Extra 253 255 0 N 1 39 8 -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t9 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 test_sequence ------ delete tests ------ delete from t1 ; diff --git a/mysql-test/main/ps_5merge.result b/mysql-test/main/ps_5merge.result index 49155394e2a..42c12f51388 100644 --- a/mysql-test/main/ps_5merge.result +++ b/mysql-test/main/ps_5merge.result @@ -1200,6 +1200,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def id 8 3 1 Y 32928 0 63 def select_type 253 19 6 N 1 39 8 def table 253 64 2 Y 0 39 8 +def partitions 250 6316032 0 Y 0 39 8 def type 253 10 3 Y 0 39 8 def possible_keys 253 4_OR_8_K 0 Y 0 39 8 def key 253 64 0 Y 0 39 8 @@ -1207,8 +1208,8 @@ def key_len 253 4_OR_8_K 0 Y 0 39 8 def ref 253 2048 0 Y 0 39 8 def rows 253 64 1 Y 0 39 8 def Extra 253 255 0 N 1 39 8 -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t9 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 test_sequence ------ delete tests ------ delete from t1 ; @@ -4568,6 +4569,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def id 8 3 1 Y 32928 0 63 def select_type 253 19 6 N 1 39 8 def table 253 64 2 Y 0 39 8 +def partitions 250 6316032 0 Y 0 39 8 def type 253 10 3 Y 0 39 8 def possible_keys 253 4_OR_8_K 0 Y 0 39 8 def key 253 64 0 Y 0 39 8 @@ -4575,8 +4577,8 @@ def key_len 253 4_OR_8_K 0 Y 0 39 8 def ref 253 2048 0 Y 0 39 8 def rows 253 64 1 Y 0 39 8 def Extra 253 255 0 N 1 39 8 -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t9 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 test_sequence ------ delete tests ------ delete from t1 ; diff --git a/mysql-test/main/query_cache.result b/mysql-test/main/query_cache.result index 3a81b648171..e257faeb28f 100644 --- a/mysql-test/main/query_cache.result +++ b/mysql-test/main/query_cache.result @@ -235,8 +235,8 @@ CURRENT_USER() select benchmark(1,1) from t1; benchmark(1,1) explain extended select benchmark(1,1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select benchmark(1,1) AS `benchmark(1,1)` from `test`.`t1` show status like "Qcache_queries_in_cache"; diff --git a/mysql-test/main/range.result b/mysql-test/main/range.result index 11bf47f4500..2d550750dfc 100644 --- a/mysql-test/main/range.result +++ b/mysql-test/main/range.result @@ -37,8 +37,8 @@ event_date type event_id 1999-07-13 100600 26 1999-07-14 100600 10 explain select event_date,type,event_id from t1 WHERE type = 100601 and event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND (type=100600 OR type=100100) or event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND type=100099; event_date type event_id 1999-07-10 100100 24 @@ -224,49 +224,49 @@ create table t1 (x int, y int, index(x), index(y)); insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9); update t1 set y=x; explain select * from t1, t1 t2 where t1.y = 8 and t2.x between 7 and t1.y+0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref y y 5 const 1 +1 SIMPLE t2 NULL range x x 5 NULL 2 Using index condition; Using where; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 8 and t2.x >= 7 and t2.x <= t1.y+0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref y y 5 const 1 +1 SIMPLE t2 NULL range x x 5 NULL 2 Using index condition; Using where; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref y y 5 const 1 +1 SIMPLE t2 NULL range x x 5 NULL 3 Using index condition; Using where; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref y y 5 const 1 +1 SIMPLE t2 NULL range x x 5 NULL 3 Using index condition; Using where; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref y y 5 const 1 +1 SIMPLE t2 NULL range x x 5 NULL 2 Using index condition; Using where; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref y y 5 const 1 +1 SIMPLE t2 NULL range x x 5 NULL 2 Using index condition; Using where; Using join buffer (flat, BNL join) explain select count(*) from t1 where x in (1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref x x 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref x x 5 const 1 Using index explain select count(*) from t1 where x in (1,2,3,4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range x x 5 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range x x 5 NULL 4 Using where; Using index drop table t1; CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1)); INSERT INTO t1 VALUES (0),(0),(0),(0),(0),(1),(1); CREATE TABLE t2 (keya int(11) NOT NULL default '0', KEY j1 (keya)); INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2); explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref j1 j1 4 const 1 Using index -1 SIMPLE t1 range i1 i1 4 NULL 7 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref j1 j1 4 const 1 Using index +1 SIMPLE t1 NULL range i1 i1 4 NULL 7 Using where; Using index; Using join buffer (flat, BNL join) explain select * from t1 force index(i1), t2 force index(j1) where (t1.key1 <t2.keya + 1) and t2.keya=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref j1 j1 4 const 1 Using index -1 SIMPLE t1 range i1 i1 4 NULL 7 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref j1 j1 4 const 1 Using index +1 SIMPLE t1 NULL range i1 i1 4 NULL 7 Using where; Using index; Using join buffer (flat, BNL join) DROP TABLE t1,t2; CREATE TABLE t1 ( a int(11) default NULL, @@ -280,8 +280,8 @@ INSERT INTO t1 VALUES (21,4),(22,5),(23,5),(24,5),(25,5),(26,5),(30,5),(31,5),(32,5),(33,5), (33,5),(33,5),(33,5),(33,5),(34,5),(35,5); EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter a,b b|a 5|5 const 15 (5%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref|filter a,b b|a 5|5 const 15 (5%) Using where; Using rowid filter SELECT * FROM t1 WHERE a IN(1,2) AND b=5; a b DROP TABLE t1; @@ -427,21 +427,21 @@ test.t1 analyze status OK test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uid_index uid_index 4 NULL 111 Using index condition -1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 111 Using index condition +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uid_index uid_index 4 NULL 111 Using index condition -1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 111 Using index condition +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uid_index uid_index 4 NULL 112 Using index condition -1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 112 Using index condition +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uid_index uid_index 4 NULL 112 Using index condition -1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 112 Using index condition +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; id name uid id name uid 1001 A 1 1001 A 1 @@ -590,29 +590,29 @@ create index t1i on t1(a); insert into t1 select 18446744073709551615; insert into t1 select 18446744073709551614; explain select * from t1 where a <> -1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index t1i t1i 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 Using where; Using index select * from t1 where a <> -1; a 18446744073709551614 18446744073709551615 explain select * from t1 where a > -1 or a < -1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index t1i t1i 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 Using where; Using index select * from t1 where a > -1 or a < -1; a 18446744073709551614 18446744073709551615 explain select * from t1 where a > -1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index t1i t1i 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 Using where; Using index select * from t1 where a > -1; a 18446744073709551614 18446744073709551615 explain select * from t1 where a < -1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables select * from t1 where a < -1; a drop table t1; @@ -621,17 +621,17 @@ create table t1 (a char(10), b text, key (a)) character set latin1; INSERT INTO t1 (a) VALUES ('111'),('222'),('222'),('222'),('222'),('444'),('aaa'),('AAA'),('bbb'); explain select * from t1 where a='aaa'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 11 const 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 11 const 2 Using index condition explain select * from t1 where a=binary 'aaa'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 11 const 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 11 const 2 Using index condition explain select * from t1 where a='aaa' collate latin1_bin; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 11 const 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 11 const 2 Using index condition explain select * from t1 where a='aaa' collate latin1_german1_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a NULL NULL NULL 9 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 9 Using where drop table t1; CREATE TABLE t1 ( `CLIENT` char(3) character set latin1 collate latin1_bin NOT NULL default '000', @@ -675,8 +675,8 @@ drop table t1, t2; create table t1(a char(2), key(a(1))); insert into t1 values ('x'), ('xx'); explain select a from t1 where a > 'x'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 2 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 2 NULL 2 Using where select a from t1 where a > 'x'; a xx @@ -722,9 +722,9 @@ SELECT s.oxid FROM t1 v, t1 s WHERE v.oxrootid ='d8c4177d09f8b11f5.52725521' AND s.oxleft > v.oxleft AND s.oxleft < v.oxright; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE v ALL OXLEFT,OXRIGHT,OXROOTID NULL NULL NULL 12 Using where -1 SIMPLE s ALL OXLEFT NULL NULL NULL 12 Range checked for each record (index map: 0x4) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE v NULL ALL OXLEFT,OXRIGHT,OXROOTID NULL NULL NULL 12 Using where +1 SIMPLE s NULL ALL OXLEFT NULL NULL NULL 12 Range checked for each record (index map: 0x4) SELECT s.oxid FROM t1 v, t1 s WHERE v.oxrootid ='d8c4177d09f8b11f5.52725521' AND @@ -902,11 +902,11 @@ INSERT INTO t1 VALUES (55,'C'), (56,'C'), (57,'C'), (58,'C'), (59,'C'), (60,'C'); INSERT INTO t1(status) SELECT status FROM t1; EXPLAIN SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 18 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 Using index condition EXPLAIN SELECT * FROM t1 WHERE status NOT IN ('A','B'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 18 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 Using index condition SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B'; id status 53 C @@ -944,17 +944,17 @@ id status 119 C 120 C EXPLAIN SELECT status FROM t1 WHERE status <> 'A' AND status <> 'B'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 18 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 Using where; Using index EXPLAIN SELECT status FROM t1 WHERE status NOT IN ('A','B'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 18 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 17 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range status status 23 NULL 17 Using index condition EXPLAIN SELECT * FROM t1 WHERE status < 'A' OR status > 'B'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 17 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range status status 23 NULL 17 Using index condition SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B'; id status 53 C @@ -997,17 +997,17 @@ INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3),(4,1),(4,2),(4,3); CREATE VIEW v1 as SELECT a,b FROM t1 WHERE b=3; EXPLAIN SELECT a,b FROM t1 WHERE a < 2 and b=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 Using where; Using index EXPLAIN SELECT a,b FROM v1 WHERE a < 2 and b=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 Using where; Using index EXPLAIN SELECT a,b FROM t1 WHERE a < 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 Using where; Using index EXPLAIN SELECT a,b FROM v1 WHERE a < 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 Using where; Using index SELECT a,b FROM t1 WHERE a < 2 and b=3; a b 1 3 @@ -1046,17 +1046,17 @@ INSERT INTO `t1` VALUES (0,0),(1,0),(2,0),(3,0),(4,0),(5,1),(6,1),(7,1),(8,1),(9,1),(10,2),(11,2),(12,2) ,(13,2),(14,2),(15,3),(16,3),(17,3),(18,3),(19,3); explain select * from t1 where a in (3,4) and b in (1,2,3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # Using where; Using index explain select * from v1 where a in (3,4) and b in (1,2,3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # Using where; Using index explain select * from t1 where a between 3 and 4 and b between 1 and 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # Using where; Using index explain select * from v1 where a between 3 and 4 and b between 1 and 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # Using where; Using index drop view v1; drop table t1; create table t3 (a int); @@ -1070,21 +1070,21 @@ insert into t1 select concat('a', 1000 + A.a + 10 * (B.a + 10 * C.a)), '' create table t2 (a varchar(10), filler char(200), key(a)); insert into t2 select * from t1; explain select * from t1 where a between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 13 NULL # Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 13 NULL # Using index condition explain select * from t1 where a = 'a' or a='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 13 NULL # Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 13 NULL # Using index condition explain select * from t2 where a between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 13 const # Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref a a 13 const # Using index condition explain select * from t2 where a = 'a' or a='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 13 const # Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref a a 13 const # Using index condition update t1 set a='b' where a<>'a'; explain select * from t1 where a not between 'b' and 'b'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 13 NULL # Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 13 NULL # Using index condition select a, hex(filler) from t1 where a not between 'b' and 'b'; a hex(filler) a 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -1105,11 +1105,11 @@ id b c 0 3 4 0 3 4 EXPLAIN SELECT * FROM t1 WHERE b<=3 AND 3<=c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx2 idx2 4 NULL 2 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1,idx2 idx2 4 NULL 2 Using index condition; Using where EXPLAIN SELECT * FROM t1 WHERE 3 BETWEEN b AND c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx2 idx2 4 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1,idx2 idx2 4 NULL 2 Using where SELECT * FROM t1 WHERE 0 < b OR 0 > c; id b c 0 3 4 @@ -1119,11 +1119,11 @@ id b c 0 3 4 0 3 4 EXPLAIN SELECT * FROM t1 WHERE 0 < b OR 0 > c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge idx1,idx2 idx1,idx2 4,4 NULL 3 Using sort_union(idx1,idx2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge idx1,idx2 idx1,idx2 4,4 NULL 3 Using sort_union(idx1,idx2); Using where EXPLAIN SELECT * FROM t1 WHERE 0 NOT BETWEEN b AND c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge idx1,idx2 idx1,idx2 4,4 NULL 3 Using sort_union(idx1,idx2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge idx1,idx2 idx1,idx2 4,4 NULL 3 Using sort_union(idx1,idx2); Using where DROP TABLE t1; CREATE TABLE t1 ( item char(20) NOT NULL default '', @@ -1137,8 +1137,8 @@ INSERT INTO t1 VALUES ('A1','2005-12-12 08:00:00',3000), ('A2','2005-12-01 08:00:00',1000); EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 20 const 3 Using index condition SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; item started price Warnings: @@ -1149,8 +1149,8 @@ A1 2005-11-01 08:00:00 1000.000 A1 2005-11-15 00:00:00 2000.000 DROP INDEX `PRIMARY` ON t1; EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; item started price Warnings: @@ -1175,8 +1175,8 @@ INSERT INTO t1 VALUES (9,'2007-01-09'),(10,'2007-01-10'),(11,'2007-01-11'); This must use range access: explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '2007-01-02 23:59:59'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range dateval dateval 4 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range dateval dateval 4 NULL 2 Using index condition drop table t1; CREATE TABLE t1 ( a varchar(32), index (a) @@ -1189,8 +1189,8 @@ a B B EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 35 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 35 NULL 3 Using where; Using index DROP TABLE t1; CREATE TABLE t1 (f1 TINYINT(11) UNSIGNED NOT NULL, PRIMARY KEY (f1)); INSERT INTO t1 VALUES (127),(254),(0),(1),(255); @@ -1242,8 +1242,8 @@ select 'In following EXPLAIN the access method should be ref, #rows~=500 (and no Z In following EXPLAIN the access method should be ref, #rows~=500 (and not 2) explain select * from t2 where a=1000 and b<11; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 5 const 503 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref a a 5 const 503 Using index condition drop table t1, t2; CREATE TABLE t1( a INT, b INT, KEY( a, b ) ); CREATE TABLE t2( a INT, b INT, KEY( a, b ) ); @@ -1282,8 +1282,8 @@ SELECT * FROM t1 WHERE 23 <= a AND a < 25 OR 25 < a AND b = 23 OR 23 <= a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 Using where; Using index SELECT * FROM t1 WHERE 23 <= a AND a < 25 OR 25 <= a AND b = 23 OR @@ -1296,8 +1296,8 @@ SELECT * FROM t1 WHERE 23 <= a AND a < 25 OR 25 <= a AND b = 23 OR 23 <= a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 3 Using where; Using index SELECT * FROM t1 WHERE 23 <= a AND a <= 25 OR 25 <= a AND b = 23 OR @@ -1310,8 +1310,8 @@ SELECT * FROM t1 WHERE 23 <= a AND a <= 25 OR 25 <= a AND b = 23 OR 23 <= a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 Using where; Using index SELECT * FROM t1 WHERE 23 <= a AND a <= 25 OR 23 <= a; @@ -1322,8 +1322,8 @@ EXPLAIN SELECT * FROM t1 WHERE 23 <= a AND a <= 25 OR 23 <= a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 Using where; Using index SELECT * FROM t2 WHERE 5 <= a AND a < 10 AND b = 1 OR 15 <= a AND a < 20 AND b = 3 @@ -1361,8 +1361,8 @@ SELECT * FROM t2 WHERE 15 <= a AND a < 20 AND b = 3 OR 1 <= a AND b = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 10 NULL 49 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 10 NULL 49 Using where; Using index SELECT * FROM t2 WHERE 5 <= a AND a < 10 AND b = 2 OR 15 <= a AND a < 20 AND b = 3 @@ -1405,8 +1405,8 @@ SELECT * FROM t2 WHERE 15 <= a AND a < 20 AND b = 3 OR 1 <= a AND b = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 10 NULL 49 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 10 NULL 49 Using where; Using index SELECT * FROM t3 WHERE 5 <= a AND a < 10 AND b = 3 OR a < 5 OR @@ -1426,8 +1426,8 @@ SELECT * FROM t3 WHERE 5 <= a AND a < 10 AND b = 3 OR a < 5 OR a < 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range a a 5 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL range a a 5 NULL 9 Using where; Using index DROP TABLE t1, t2, t3; # # Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN @@ -1458,8 +1458,8 @@ INSERT INTO t2 VALUES ('2009-09-21 12:00:00'), ('2009-09-21 12:00:00'), # DATE vs DATE EXPLAIN SELECT * FROM t1 WHERE a >= '2009/09/23'; -id select_type table type possible_keys key key_len ref rows Extra -X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows Extra +X X X X range a a X X X X SELECT * FROM t1 WHERE a >= '2009/09/23'; a 2009-09-23 @@ -1493,8 +1493,8 @@ a # DATE vs DATETIME EXPLAIN SELECT * FROM t2 WHERE a >= '2009/09/23'; -id select_type table type possible_keys key key_len ref rows Extra -X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows Extra +X X X X range a a X X X X SELECT * FROM t2 WHERE a >= '2009/09/23'; a 2009-09-23 12:00:00 @@ -1533,8 +1533,8 @@ a # DATETIME vs DATETIME EXPLAIN SELECT * FROM t2 WHERE a >= '2009/09/23 12:00:00'; -id select_type table type possible_keys key key_len ref rows Extra -X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows Extra +X X X X range a a X X X X SELECT * FROM t2 WHERE a >= '2009/09/23 12:00:00'; a 2009-09-23 12:00:00 @@ -1568,8 +1568,8 @@ a # DATETIME vs DATE EXPLAIN SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00'; -id select_type table type possible_keys key key_len ref rows Extra -X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows Extra +X X X X range a a X X X X SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00'; a 2009-09-23 @@ -1682,8 +1682,8 @@ INSERT INTO t1 VALUES (0,0), (1,1); EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE (a>=1 AND a<=2) OR (a>=4 AND a<=5) OR (a>=0 AND a <=10); -id select_type table type possible_keys key key_len ref rows Extra -@ @ @ range @ @ @ @ @ @ +id select_type table partitions type possible_keys key key_len ref rows Extra +@ @ @ @ range @ @ @ @ @ @ # Should return 2 rows SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE (a>=1 AND a<=2) OR (a>=4 AND a<=5) OR (a>=0 AND a <=10); @@ -1697,8 +1697,8 @@ DROP TABLE t1; CREATE TABLE t1 (c_key INT, c_notkey INT, KEY(c_key)); INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3); EXPLAIN SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL c_key NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL c_key NULL NULL NULL 3 Using where SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key; c_key c_notkey 1 1 @@ -1713,37 +1713,37 @@ INSERT INTO t1 VALUES (1,10), (2,20), (3,30), (4,40), (5,50), (6,60), (7,70), (8,80); EXPLAIN SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const i4_uq i4_uq 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const i4_uq i4_uq 5 const 1 SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 10; pk i4 1 10 EXPLAIN SELECT * FROM t1 WHERE 10 BETWEEN i4 AND i4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const i4_uq i4_uq 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const i4_uq i4_uq 5 const 1 SELECT * FROM t1 WHERE 10 BETWEEN i4 AND i4; pk i4 1 10 EXPLAIN SELECT * FROM t1 WHERE 70 BETWEEN 70 AND i4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range i4_uq i4_uq 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 2 Using index condition SELECT * FROM t1 WHERE 70 BETWEEN 70 AND i4; pk i4 7 70 8 80 EXPLAIN SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range i4_uq i4_uq 5 NULL 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 1 Using index condition SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10; pk i4 1 10 EXPLAIN SELECT * FROM t1 WHERE 10 BETWEEN 10 AND 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 SELECT * FROM t1 WHERE 10 BETWEEN 10 AND 10; pk i4 1 10 @@ -1756,56 +1756,56 @@ pk i4 8 80 EXPLAIN SELECT * FROM t1 WHERE 10 BETWEEN 11 AND 11; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT * FROM t1 WHERE 10 BETWEEN 11 AND 11; pk i4 EXPLAIN SELECT * FROM t1 WHERE 10 BETWEEN 100 AND 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT * FROM t1 WHERE 10 BETWEEN 100 AND 0; pk i4 EXPLAIN SELECT * FROM t1 WHERE i4 BETWEEN 100 AND 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 WHERE i4 BETWEEN 100 AND 0; pk i4 EXPLAIN SELECT * FROM t1 WHERE i4 BETWEEN 70 AND 99999999999999999; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range i4_uq i4_uq 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 2 Using index condition SELECT * FROM t1 WHERE i4 BETWEEN 70 AND 99999999999999999; pk i4 7 70 8 80 EXPLAIN SELECT * FROM t1 WHERE i4 BETWEEN 999999999999999 AND 30; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 WHERE i4 BETWEEN 999999999999999 AND 30; pk i4 EXPLAIN SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range i4_uq i4_uq 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 2 Using index condition SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20'; pk i4 1 10 2 20 EXPLAIN SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL i4_uq NULL NULL NULL 8 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL i4_uq NULL NULL NULL 8 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 Using index condition SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4; pk i4 pk i4 EXPLAIN SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL i4_uq NULL NULL NULL 8 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL i4_uq NULL NULL NULL 8 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 Using index condition SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk; pk i4 pk i4 DROP TABLE t1; @@ -1953,9 +1953,9 @@ insert into t2 select a+64 from t2; explain select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 between 920 and 930) and t1.key2 < 1000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 64 -1 SIMPLE t1 range i1,i2 i1 4 NULL 12 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 64 +1 SIMPLE t1 NULL range i1,i2 i1 4 NULL 12 Using where; Using join buffer (flat, BNL join) select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 between 920 and 930) and t1.key2 < 1000; count(*) @@ -1963,9 +1963,9 @@ count(*) explain select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 between 920 and 930) and t1.key2 < t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 64 -1 SIMPLE t1 range i1,i2 i1 4 NULL 12 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 64 +1 SIMPLE t1 NULL range i1,i2 i1 4 NULL 12 Using where; Using join buffer (flat, BNL join) select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 between 920 and 930) and t1.key2 < t2.a; count(*) @@ -1980,8 +1980,8 @@ create table t1 (a int, b int, c int, key idx (a,b,c)); insert into t1 values (0,0,0), (2,2,0), (1,1,1), (2,2,1); explain select * from t1 force index (idx) where a >=1 and c <= 1 and a=b and b > 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 2 Using where; Using index select * from t1 force index (idx) where a >=1 and c <= 1 and a=b and b > 1; a b c 2 2 0 @@ -2010,8 +2010,8 @@ INSERT INTO t100(I,J) SELECT X.I, X.K+(10*Y.K) FROM t10 AS X,t10 AS Y; INSERT INTO t100(I,J) VALUES(8,26); EXPLAIN SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t100 range I I 10 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t100 NULL range I I 10 NULL 3 Using index condition SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5); K I J @@ -2115,14 +2115,14 @@ INSERT INTO t1 (fd) SELECT fd FROM t1; # The following should show "Impossible WHERE" : explain SELECT * FROM t1 WHERE fd='😁'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 WHERE fd='😁'; id fd # The following must not use range access: explain select count(*) from t1 where fd <'😁'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ix_fd ix_fd 63 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ix_fd ix_fd 63 NULL # Using where; Using index select count(*) from t1 where fd <'😁'; count(*) 40960 @@ -2185,8 +2185,8 @@ CREATE TABLE t1 (a INT, INDEX(a)); INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); explain SELECT * FROM t1 WHERE a > 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 4 Using where; Using index SELECT * FROM t1 WHERE a > 5; a 6 @@ -2224,8 +2224,8 @@ INSERT INTO t2 VALUES ('2001-01-01 11:22:33'); # range/ref access cannot be used for this query EXPLAIN SELECT * FROM t2 WHERE b=CAST('2001-01-01' AS DATE); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b b 67 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index b b 67 NULL 5 Using where; Using index SELECT * FROM t2 WHERE b=CAST('2001-01-01' AS DATE); b 2001#01#01 @@ -2237,9 +2237,9 @@ b # See BUG#13814468 about 'Range checked for each record' EXPLAIN SELECT * FROM t1, t2 WHERE a=b ORDER BY BINARY a, BINARY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -1 SIMPLE t2 ALL b NULL NULL NULL 5 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL b NULL NULL NULL 5 Range checked for each record (index map: 0x1) SELECT * FROM t1, t2 WHERE a=b ORDER BY BINARY a, BINARY b; a b 2001-01-01 00:00:00 2001#01#01 @@ -2249,9 +2249,9 @@ a b 2001-01-01 11:22:33 2001-01-01 11:22:33 EXPLAIN SELECT * FROM t1, t2 WHERE b=a ORDER BY BINARY a, BINARY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -1 SIMPLE t2 ALL b NULL NULL NULL 5 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL b NULL NULL NULL 5 Range checked for each record (index map: 0x1) SELECT * FROM t1, t2 WHERE b=a ORDER BY BINARY a, BINARY b; a b 2001-01-01 00:00:00 2001#01#01 @@ -2271,26 +2271,26 @@ insert into t2 select A.a + B.a* 10 + C.a * 100 from t1 A, t1 B, t1 C; alter table t2 add key(a); # Should have "range checked for each table" for second table: explain select * from t1, t2 where t2.a < t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 -1 SIMPLE t2 ALL a NULL NULL NULL 1000 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 NULL ALL a NULL NULL NULL 1000 Range checked for each record (index map: 0x1) # Should have "range checked for each table" for second table: explain select * from t1, t2 where t1.a > t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 -1 SIMPLE t2 ALL a NULL NULL NULL 1000 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 NULL ALL a NULL NULL NULL 1000 Range checked for each record (index map: 0x1) create table t3 (a int primary key, b int); insert into t3 select a,a from t1; # The second table should use 'range': explain select * from t3, t2 where t2.a < t3.b and t3.a=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range a a 5 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range a a 5 NULL 1 Using where; Using index # The second table should use 'range': explain select * from t3, t2 where t3.b > t2.a and t3.a=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range a a 5 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range a a 5 NULL 1 Using where; Using index drop table t1,t2,t3; # # MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE. @@ -2307,33 +2307,33 @@ from t1 A, t1 B, t1 C; # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: explain extended select * from t2 where (b > 25 and b < 15) or a<44; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a,b a 5 NULL 43 100.00 Using index condition Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`a` < 44 # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: explain extended select * from t2 where a < 44 or (b > 25 and b < 15); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a,b a 5 NULL 43 100.00 Using index condition Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`a` < 44 # Here, conditions b will not be removed, because "c<44" is not sargable # and hence (b.. and .. b) part is not analyzed at all: explain extended select * from t2 where c < 44 or (b > 25 and b < 15); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL b NULL NULL NULL 1000 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` < 44 or `test`.`t2`.`b` > 25 and `test`.`t2`.`b` < 15 # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: explain extended select * from t2 where (b > 25 and b < 15) or c < 44; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL b NULL NULL NULL 1000 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` < 44 # Try a case where both OR parts produce SEL_ARG::IMPOSSIBLE: explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 44 AS `a`,15 AS `b`,NULL AS `c` from `test`.`t2` where 0 drop table t1,t2; @@ -2346,11 +2346,11 @@ drop table t1,t2; CREATE TABLE t1 (a INT, b INT, KEY(a)); INSERT INTO t1 (a) VALUES (10),(10),(10),(10),(10),(10),(10),(10),(10),(10),(70); EXPLAIN SELECT * FROM t1 WHERE a<>10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 Using index condition EXPLAIN SELECT * FROM t1 WHERE 10<>a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 Using index condition SELECT * FROM t1 WHERE a<>10; a b 70 NULL @@ -2365,8 +2365,8 @@ SET NAMES utf8; CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8, KEY(a)) ENGINE=MyISAM; INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e'); EXPLAIN SELECT * FROM t1 WHERE a<=>'😎'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t1; # # MDEV-10185: Assertion `tree1->keys[key_no] && tree2->keys[key_no]' failed in @@ -2405,8 +2405,8 @@ insert into t1 values (82,12,'wxa'), (85,15,'xd'); # range access to t1 by 2-component keys for index idx explain select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 10 NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 10 NULL 6 Using where explain format=json select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7)); EXPLAIN { @@ -2469,8 +2469,8 @@ a b c deallocate prepare stmt; # range access to t1 by 1-component keys for index idx explain select * from t1 where (a,b+a) IN ((4,9),(8,8),(7,7)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 5 Using where explain format=json select * from t1 where (a,b+a) IN ((4,9),(8,8),(7,7)); EXPLAIN { @@ -2499,8 +2499,8 @@ a b c 4 5 wa # range access to t1 by 1-component keys for index idx explain select * from t1 where (a,b) IN ((4,a-1),(8,a+8),(7,a+7)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 5 Using where explain format=json select * from t1 where (a,b) IN ((4,a-1),(8,a+8),(7,a+7)); EXPLAIN { @@ -2541,9 +2541,9 @@ insert into t2 values # range access to t1 by keys for index idx1 explain select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(2,2)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range|filter idx1,idx2 idx1|idx2 5|5 NULL 3 (60%) Using index condition; Using where; Using rowid filter -1 SIMPLE t1 ref idx idx 5 test.t2.d 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range|filter idx1,idx2 idx1|idx2 5|5 NULL 3 (60%) Using index condition; Using where; Using rowid filter +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 8 explain format=json select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(2,2)); EXPLAIN @@ -2627,9 +2627,9 @@ insert into t2 values # range access to t1 by 1-component keys for index idx explain select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range|filter idx1,idx2 idx1|idx2 5|5 NULL 8 (14%) Using index condition; Using where; Using rowid filter -1 SIMPLE t1 ref idx idx 5 test.t2.d 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range|filter idx1,idx2 idx1|idx2 5|5 NULL 8 (14%) Using index condition; Using where; Using rowid filter +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 8 explain format=json select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1; EXPLAIN @@ -2738,9 +2738,9 @@ insert into t1 select * from t1; # range access to t2 by keys for index idx2 explain select * from t1,t2 where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range|filter idx1,idx2 idx1|idx2 5|5 NULL 7 (7%) Using index condition; Using where; Using rowid filter -1 SIMPLE t1 ref idx idx 5 test.t2.d 11 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range|filter idx1,idx2 idx1|idx2 5|5 NULL 7 (7%) Using index condition; Using where; Using rowid filter +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 11 explain format=json select * from t1,t2 where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1; EXPLAIN @@ -2802,9 +2802,9 @@ alter table t2 drop index idx1, drop index idx2, add index idx3(d,e); # range access to t2 by 2-component keys for index idx3 explain select * from t1,t2 where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx3 idx3 10 NULL 5 Using index condition; Using where -1 SIMPLE t1 ref idx idx 5 test.t2.d 11 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx3 idx3 10 NULL 5 Using index condition; Using where +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 11 explain format=json select * from t1,t2 where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1; EXPLAIN @@ -2857,9 +2857,9 @@ a b c d e f # range access to t1 by 1-component keys for index idx explain select * from t1,t2 where a = d and (a,e) in ((4,d+1),(7,d+1),(8,d+1)) and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 15 Using index condition -1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 15 Using index condition +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 Using where explain format=json select * from t1,t2 where a = d and (a,e) in ((4,d+1),(7,d+1),(8,d+1)) and length(f) = 1; EXPLAIN @@ -2920,9 +2920,9 @@ a b c d e f # no range access explain select * from t1,t2 where a = d and (a,e) in ((e,d+1),(7,7),(8,8)) and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL idx NULL NULL NULL 144 Using where -1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 144 Using where +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 Using where explain format=json select * from t1,t2 where a = d and (a,e) in ((e,d+1),(7,7),(8,8)) and length(f) = 1; EXPLAIN @@ -2973,9 +2973,9 @@ a b c d e f explain select * from t1,t2 where a = d and (a,2) in ((2,2),(7,7),(8,8)) and length(c) = 1 and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 12 Using index condition; Using where -1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 12 Using index condition; Using where +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 Using where explain format=json select * from t1,t2 where a = d and (a,2) in ((2,2),(7,7),(8,8)) and length(c) = 1 and length(f) = 1; @@ -3054,10 +3054,10 @@ explain select * from t1,t2,t3 where id = 1 and a = d and (a,v+1) in ((2,2),(7,7),(8,8)) and length(c) = 1 and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t1 range idx idx 5 NULL 12 Using index condition; Using where -1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t1 NULL range idx idx 5 NULL 12 Using index condition; Using where +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 Using where explain format=json select * from t1,t2,t3 where id = 1 and a = d and (a,v+1) in ((2,2),(7,7),(8,8)) and @@ -3127,8 +3127,8 @@ explain select * from t1,t2,t3 where id = 1 and a = d and (a,v+1) in ((9,9),(7,7),(8,8)) and length(c) = 1 and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables prepare stmt from "select * from t1,t2,t3 where id = 1 and a = d and (a,v+1) in ((9,9),(7,7),(8,8)) and @@ -3160,8 +3160,8 @@ rec_per_key 2 set eq_range_index_dive_limit=0; explain select * from t1 where a in (8, 15, 31, 1, 9); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 7 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 7 Using index condition select * from t1 where a in (8, 15, 31, 1, 9); a b 1 yy @@ -3171,8 +3171,8 @@ a b 15 ffffzz set eq_range_index_dive_limit=2; explain select * from t1 where a in (8, 15, 31, 1, 9); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 5 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 5 Using index condition select * from t1 where a in (8, 15, 31, 1, 9); a b 1 yy @@ -3210,8 +3210,8 @@ set @query=concat('explain select * from t2 where a=1 or a in (', @query, ')'); prepare s from @query; # This should not fail with an error: execute s; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL a NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 3 Using where set max_session_mem_used=@tmp_24117; deallocate prepare s; drop table t0,t1,t2; @@ -3236,8 +3236,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1 where ((a between 3 and 4) and b < 100) or (a between 2 and 5); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where select * from t1 where ((a between 3 and 4) and b < 100) or (a between 2 and 5); pk a b 7 2 20 @@ -3249,8 +3249,8 @@ pk a b 1 5 50 65 5 50 explain select * from t1 where (a between 2 and 5) or ((a between 3 and 4) and b < 100); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where select * from t1 where (a between 2 and 5) or ((a between 3 and 4) and b < 100); pk a b 7 2 20 @@ -3262,8 +3262,8 @@ pk a b 1 5 50 65 5 50 explain select * from t1 where (a between 3 and 4) or ((a between 2 and 5) and b < 100); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where select * from t1 where (a between 3 and 4) or ((a between 2 and 5) and b < 100); pk a b 7 2 20 @@ -3275,8 +3275,8 @@ pk a b 1 5 50 65 5 50 explain select * from t1 where ((a between 2 and 5) and b < 100) or (a between 3 and 4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where select * from t1 where ((a between 2 and 5) and b < 100) or (a between 3 and 4); pk a b 7 2 20 @@ -3300,8 +3300,8 @@ insert into t2 (pk, key1) select A.a+10 *B.a + 100*C.a, A.a+10 *B.a +100*C.a from t1 A, t1 B, t1 C; # This must use ALL, not range: explain select * from t2 force index (primary) where pk not in (1,2,3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1000 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 1000 Using where drop table t1,t2; # # MDEV-24444: ASAN use-after-poison in Item_func_in::get_func_mm_tree with NOT IN @@ -3321,8 +3321,8 @@ create table t1 (pk int primary key, a int); insert into t1 (pk) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); # must not use range: explain select * from t1 force index (primary) where pk != 1 and pk!=2 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 10 Using where drop table t1; # # MDEV-22251: get_key_scans_params: Conditional jump or move depends on uninitialised value @@ -3333,9 +3333,9 @@ create table t2 (a int, b int); insert into t2 values (1,2),(2,4); EXPLAIN select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t1 ALL PRIMARY,v NULL NULL NULL 8 Range checked for each record (index map: 0x3) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 NULL ALL PRIMARY,v NULL NULL NULL 8 Range checked for each record (index map: 0x3) select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk); pk i v a b 1 1 2 1 2 @@ -3380,13 +3380,13 @@ create table t2(a int, key(a)); insert into t2 select A.a + B.a*10 + C.a*100 from ten A, ten B,ten C where A.a + B.a*10 + C.a*100 < 199; # expected type=range, rows=1487 , reason=using index dives analyze SELECT * FROM t1 where a in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 range a a 5 NULL 1487 1199.00 100.00 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 1487 1199.00 100.00 100.00 Using where; Using index insert into t2 values (200),(201); # expected type=range, rows=201 , reason=using index statistics analyze SELECT * FROM t1 where a in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 range a a 5 NULL 201 1201.00 100.00 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 201 1201.00 100.00 100.00 Using where; Using index drop table t1,ten,t2; # End of 10.4 tests # @@ -3418,9 +3418,9 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date # expected for t1: range access and rows = 4 (not 1000) explain SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition -1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 Using index condition +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id; id subset_id id col 0 0 0 0 @@ -3431,9 +3431,9 @@ id subset_id id col # with a subquery # expected the same plan as above explain SELECT * FROM t1 WHERE t1.subset_id IN (SELECT t2.id FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition -1 PRIMARY t2 ref id id 5 test.t1.subset_id 1 Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 Using index condition +1 PRIMARY t2 NULL ref id id 5 test.t1.subset_id 1 Using index; FirstMatch(t1) SELECT * FROM t1 WHERE t1.subset_id IN (SELECT t2.id FROM t2); id subset_id 0 0 @@ -3445,10 +3445,10 @@ id subset_id # expected for t1: range access and rows = 4 (not 1000) explain SELECT * FROM t1 WHERE t1.subset_id IN (SELECT max(t2.id) FROM t2 group by t2.col); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1.subset_id 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 1000 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 Using index condition +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t1.subset_id 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1000 Using temporary SELECT * FROM t1 WHERE t1.subset_id IN (SELECT max(t2.id) FROM t2 group by t2.col); id subset_id @@ -3462,9 +3462,9 @@ create view v2 as SELECT t2.id FROM t2 group by t2.col; # with mergeable view # expected for t1: range access and rows = 4 (not 1000) explain SELECT * FROM t1, v1 where t1.subset_id=v1.id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition -1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 Using index condition +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 Using index SELECT * FROM t1, v1 where t1.subset_id=v1.id; id subset_id id 0 0 0 @@ -3475,10 +3475,10 @@ id subset_id id # with non-mergeable view # expected for t1: range access and rows = 4 (not 1000) explain SELECT * FROM t1, v2 where t1.subset_id=v2.id; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition -1 PRIMARY <derived2> ref key0 key0 5 test.t1.subset_id 10 -2 DERIVED t2 ALL NULL NULL NULL NULL 1000 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 Using index condition +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.subset_id 10 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 1000 Using temporary; Using filesort SELECT * FROM t1, v2 where t1.subset_id=v2.id; id subset_id id 0 0 0 @@ -3488,9 +3488,9 @@ id subset_id id 4 4 4 # expected for t2 and for t1: range access explain SELECT * FROM t2 LEFT JOIN t1 ON t1.subset_id != 5 WHERE t2.id in (0,2,4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range id id 5 NULL 3 Using index condition -1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 4 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range id id 5 NULL 3 Using index condition +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 4 Using where; Using join buffer (flat, BNL join) SELECT * FROM t2 LEFT JOIN t1 ON t1.subset_id != 5 WHERE t2.id in (0,2,4); id col id subset_id 0 0 0 0 @@ -3510,9 +3510,9 @@ id col id subset_id 4 4 4 4 # no range access expected for t1 explain SELECT * FROM t1 LEFT JOIN t2 ON t1.subset_id=t2.id LIMIT 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 -1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 Using where SELECT * FROM t1 LEFT JOIN t2 ON t1.subset_id=t2.id LIMIT 10; id subset_id id col 0 0 0 0 @@ -3527,10 +3527,10 @@ id subset_id id col 9 NULL NULL NULL # expected for t1: range access explain SELECT * FROM ten LEFT JOIN (t1,t2) ON ten.a=t2.col AND t1.subset_id=t2.id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE ten ALL NULL NULL NULL NULL 10 -1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using where -1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE ten NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 Using where +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 Using where SELECT * FROM ten LEFT JOIN (t1,t2) ON ten.a=t2.col AND t1.subset_id=t2.id; a id subset_id id col 0 0 0 0 0 @@ -3546,10 +3546,10 @@ a id subset_id id col # no range access expected for t1 explain SELECT * FROM t1 LEFT JOIN (t2,ten) ON ten.a=t2.col AND t1.subset_id=t2.id LIMIT 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 -1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using where -1 SIMPLE ten ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 Using where +1 SIMPLE ten NULL ALL NULL NULL NULL NULL 10 Using where SELECT * FROM t1 LEFT JOIN (t2,ten) ON ten.a=t2.col AND t1.subset_id=t2.id LIMIT 10; id subset_id id col a @@ -3566,9 +3566,9 @@ id subset_id id col a drop index id on t2; # expected for t1: range access explain SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition -1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 Using index condition +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1000 Using where; Using join buffer (flat, BNL join) SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id; id subset_id id col 0 0 0 0 @@ -3578,14 +3578,14 @@ id subset_id id col 4 4 4 4 # expected impossible where after reading const tables explain SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t1.subset_id IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t1.subset_id IS NULL; id subset_id id col # expected impossible where after reading const tables explain SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t2.id IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t2.id IS NULL; id subset_id id col drop index t1_subset_id on t1; @@ -3601,9 +3601,9 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date # expected for t1: range access by idx (keylen=9) explain SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id and t1.m=0 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 9 NULL 4 Using index condition -1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 9 NULL 4 Using index condition +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id and t1.m=0 ; id subset_id m id col 0 0 0 0 0 @@ -3634,9 +3634,9 @@ test.t2 analyze status Table is already up to date # expected for t1 :range access by index key1 # rows 4 instead of 500 explain SELECT * FROM t1,t2 WHERE t1.id>=1 and t1.subset_id=t2.id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range key1,t1_subset_id key1 9 NULL 3 Using where; Using index -1 SIMPLE t2 ref id id 4 test.t1.subset_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range key1,t1_subset_id key1 9 NULL 3 Using where; Using index +1 SIMPLE t2 NULL ref id id 4 test.t1.subset_id 1 SELECT * FROM t1,t2 WHERE t1.id>=1 and t1.subset_id=t2.id; id subset_id id col 1 0 0 0 @@ -3660,9 +3660,9 @@ test.t2 analyze status OK # using key1 for range access on t1 and also using index for sorting, # no filesort, rows should be 75 not 500 explain SELECT * FROM t1,t2 WHERE t1.id=t2.id AND t1.col=2 ORDER BY t2.id LIMIT 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range key1 key1 5 NULL 74 Using index condition; Using where -1 SIMPLE t2 ref id id 5 test.t1.id 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 74 Using index condition; Using where +1 SIMPLE t2 NULL ref id id 5 test.t1.id 2 SELECT * FROM t1,t2 WHERE t1.id=t2.id AND t1.col=2 ORDER BY t2.id LIMIT 10; id col id col 0 2 0 0 @@ -3689,8 +3689,8 @@ CREATE TABLE t2 (pk INT, b INT, PRIMARY KEY(pk)); INSERT INTO t2 VALUES (1,1),(2,2); SET optimizer_switch = 'not_null_range_scan=on'; EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON a = pk WHERE b >= 0 AND pk IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select NULL AS `a`,0 AS `pk`,NULL AS `b` from `test`.`t1` join `test`.`t2` where 0 SELECT * FROM t1 LEFT JOIN t2 ON a = pk WHERE b >= 0 AND pk IS NULL; diff --git a/mysql-test/main/range.test b/mysql-test/main/range.test index 6a2e318e732..e411a0197ee 100644 --- a/mysql-test/main/range.test +++ b/mysql-test/main/range.test @@ -828,13 +828,13 @@ INSERT INTO `t1` VALUES (0,0),(1,0),(2,0),(3,0),(4,0),(5,1),(6,1),(7,1),(8,1),(9,1),(10,2),(11,2),(12,2) ,(13,2),(14,2),(15,3),(16,3),(17,3),(18,3),(19,3); ---replace_column 9 # +--replace_column 10 # explain select * from t1 where a in (3,4) and b in (1,2,3); ---replace_column 9 # +--replace_column 10 # explain select * from v1 where a in (3,4) and b in (1,2,3); ---replace_column 9 # +--replace_column 10 # explain select * from t1 where a between 3 and 4 and b between 1 and 2; ---replace_column 9 # +--replace_column 10 # explain select * from v1 where a between 3 and 4 and b between 1 and 2; drop view v1; @@ -854,18 +854,18 @@ insert into t1 select concat('a', 1000 + A.a + 10 * (B.a + 10 * C.a)), '' create table t2 (a varchar(10), filler char(200), key(a)); insert into t2 select * from t1; ---replace_column 9 # +--replace_column 10 # explain select * from t1 where a between 'a' and 'a '; ---replace_column 9 # +--replace_column 10 # explain select * from t1 where a = 'a' or a='a '; ---replace_column 9 # +--replace_column 10 # explain select * from t2 where a between 'a' and 'a '; ---replace_column 9 # +--replace_column 10 # explain select * from t2 where a = 'a' or a='a '; update t1 set a='b' where a<>'a'; ---replace_column 9 # +--replace_column 10 # explain select * from t1 where a not between 'b' and 'b'; select a, hex(filler) from t1 where a not between 'b' and 'b'; @@ -1202,7 +1202,7 @@ INSERT INTO t2 VALUES ('2009-09-21 12:00:00'), ('2009-09-21 12:00:00'), ('2009-09-21 12:00:00'); --echo # DATE vs DATE ---replace_column 1 X 2 X 3 X 7 X 8 X 9 X 10 X +--replace_column 1 X 2 X 3 X 4 X 8 X 9 X 10 X 11 X 12 X EXPLAIN SELECT * FROM t1 WHERE a >= '2009/09/23'; SELECT * FROM t1 WHERE a >= '2009/09/23'; @@ -1213,7 +1213,7 @@ SELECT * FROM t1 WHERE a >= '2009.09.23'; SELECT * FROM t1 WHERE a >= '2009:09:23'; --echo # DATE vs DATETIME ---replace_column 1 X 2 X 3 X 7 X 8 X 9 X 10 X +--replace_column 1 X 2 X 3 X 4 X 8 X 9 X 10 X 11 X 12 X EXPLAIN SELECT * FROM t2 WHERE a >= '2009/09/23'; SELECT * FROM t2 WHERE a >= '2009/09/23'; @@ -1225,7 +1225,7 @@ SELECT * FROM t2 WHERE a >= '2009.09.23'; SELECT * FROM t2 WHERE a >= '2009:09:23'; --echo # DATETIME vs DATETIME ---replace_column 1 X 2 X 3 X 7 X 8 X 9 X 10 X +--replace_column 1 X 2 X 3 X 4 X 8 X 9 X 10 X 11 X 12 X EXPLAIN SELECT * FROM t2 WHERE a >= '2009/09/23 12:00:00'; SELECT * FROM t2 WHERE a >= '2009/09/23 12:00:00'; @@ -1236,7 +1236,7 @@ SELECT * FROM t2 WHERE a >= '2009.09.23 12:00:00'; SELECT * FROM t2 WHERE a >= '2009:09:23 12:00:00'; --echo # DATETIME vs DATE ---replace_column 1 X 2 X 3 X 7 X 8 X 9 X 10 X +--replace_column 1 X 2 X 3 X 4 X 8 X 9 X 10 X 11 X 12 X EXPLAIN SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00'; SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00'; @@ -1307,7 +1307,7 @@ CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a)); INSERT INTO t1 VALUES (0,0), (1,1); ---replace_column 1 @ 2 @ 3 @ 5 @ 6 @ 7 @ 8 @ 9 @ 10 @ +--replace_column 1 @ 2 @ 3 @ 4 @ 6 @ 7 @ 8 @ 9 @ 10 @ 11 @ 12 @ EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE (a>=1 AND a<=2) OR (a>=4 AND a<=5) OR (a>=0 AND a <=10); @@ -1668,7 +1668,7 @@ SELECT * FROM t1 WHERE fd='😁'; SELECT * FROM t1 WHERE fd='😁'; --echo # The following must not use range access: ---replace_column 9 # +--replace_column 10 # explain select count(*) from t1 where fd <'😁'; select count(*) from t1 where fd <'😁'; select count(*) from t1 ignore index (ix_fd) where fd <'😁'; diff --git a/mysql-test/main/range_debug.result b/mysql-test/main/range_debug.result index 5597671071e..87a0edef744 100644 --- a/mysql-test/main/range_debug.result +++ b/mysql-test/main/range_debug.result @@ -12,8 +12,8 @@ insert into t2 values (11),(13),(15); set @b= concat("explain ", @a); prepare stmt1 from @b; execute stmt1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index a a 5 NULL 1003 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index a a 5 NULL 1003 Using where; Using index prepare stmt1 from @a; execute stmt1; a diff --git a/mysql-test/main/range_innodb.result b/mysql-test/main/range_innodb.result index 1d98fad0295..7231ff2c3ce 100644 --- a/mysql-test/main/range_innodb.result +++ b/mysql-test/main/range_innodb.result @@ -34,9 +34,9 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK # The following must not use "Range checked for each record": explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 -1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 NULL range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join) drop table t0,t1,t2; # # MDEV-10466: constructing an invalid SEL_ARG @@ -56,10 +56,10 @@ set @save_optimizer_switch=@@optimizer_switch; set optimizer_switch='extended_keys=on'; explain select pk, a, b from t1,t2,t3 where b >= d and pk < c and b = '0'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t1 ref PRIMARY,idx1,idx2 idx1 5 const 3 Using index condition -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 NULL ref PRIMARY,idx1,idx2 idx1 5 const 3 Using index condition +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) select pk, a, b from t1,t2,t3 where b >= d and pk < c and b = '0'; pk a b 1 6 0 @@ -101,8 +101,8 @@ from t0 A, t0 B, t0 C, t0 D where D.a<5; SET @saved_dbug = @@GLOBAL.debug_dbug; set @@global.debug_dbug="+d,ha_index_init_fail"; explain select * from t1 where a=10 and b=10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where select * from t1 where a=10 and b=10; ERROR HY000: Table definition has changed, please retry transaction DROP TABLE t0,t1; @@ -171,8 +171,8 @@ id p es er x 14646 foobar 4 4 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE ((p = 'foo' AND er != 4) OR er = 4 ) AND (es >= 4) LIMIT 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range es,er,p es 1 NULL # 100.00 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range es,er,p es 1 NULL # 100.00 Using index condition; Using where Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`p` AS `p`,`test`.`t1`.`es` AS `es`,`test`.`t1`.`er` AS `er`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`p` = 'foo' and `test`.`t1`.`er` <> 4 or `test`.`t1`.`er` = 4) and `test`.`t1`.`es` >= 4 limit 2 set optimizer_switch='index_merge_sort_intersection=off'; @@ -183,8 +183,8 @@ id p es er x 14646 foobar 4 4 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE ((p = 'foo' AND er != 4) OR er = 4 ) AND (es >= 4) LIMIT 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range es,er,p es 1 NULL # 100.00 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range es,er,p es 1 NULL # 100.00 Using index condition; Using where Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`p` AS `p`,`test`.`t1`.`es` AS `es`,`test`.`t1`.`er` AS `er`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`p` = 'foo' and `test`.`t1`.`er` <> 4 or `test`.`t1`.`er` = 4) and `test`.`t1`.`es` >= 4 limit 2 set optimizer_switch='index_merge_sort_intersection=on'; @@ -195,8 +195,8 @@ id p es er x 14008 foobar 4 2 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE ((p = 'foo' AND er < 6) OR er >=2 ) AND (es >= 4) LIMIT 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range es,er,p es 1 NULL # 100.00 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range es,er,p es 1 NULL # 100.00 Using index condition; Using where Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`p` AS `p`,`test`.`t1`.`es` AS `es`,`test`.`t1`.`er` AS `er`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`p` = 'foo' and `test`.`t1`.`er` < 6 or `test`.`t1`.`er` >= 2) and `test`.`t1`.`es` >= 4 limit 2 set optimizer_switch='index_merge_sort_intersection=off'; @@ -207,8 +207,8 @@ id p es er x 14008 foobar 4 2 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE ((p = 'foo' AND er < 6) OR er >=2 ) AND (es >= 4) LIMIT 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range es,er,p es 1 NULL # 100.00 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range es,er,p es 1 NULL # 100.00 Using index condition; Using where Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`p` AS `p`,`test`.`t1`.`es` AS `es`,`test`.`t1`.`er` AS `er`,`test`.`t1`.`x` AS `x` from `test`.`t1` where (`test`.`t1`.`p` = 'foo' and `test`.`t1`.`er` < 6 or `test`.`t1`.`er` >= 2) and `test`.`t1`.`es` >= 4 limit 2 set optimizer_switch='index_merge_sort_intersection=default'; @@ -228,8 +228,8 @@ KEY (a,b) ) ENGINE=InnoDB; INSERT INTO t1 VALUES (1,'a',1),(2,'b',2); explain SELECT a FROM t1 WHERE pk < 0 AND a <= 'w' and b > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,a PRIMARY 4 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,a PRIMARY 4 NULL 1 Using where SELECT a FROM t1 WHERE pk < 0 AND a <= 'w' and b > 0; a drop table t1; diff --git a/mysql-test/main/range_innodb.test b/mysql-test/main/range_innodb.test index 8b9771d1d1e..2adaf0417ad 100644 --- a/mysql-test/main/range_innodb.test +++ b/mysql-test/main/range_innodb.test @@ -179,14 +179,14 @@ SELECT * FROM t1 set optimizer_switch='index_merge_sort_intersection=on'; eval $q; ---replace_column 9 # +--replace_column 10 # eval EXPLAIN EXTENDED $q; set optimizer_switch='index_merge_sort_intersection=off'; # execution of $q and explain for it led to an assertion failure in 10.4 # (with the optimizer switch rowid_filter set to 'on') eval $q; ---replace_column 9 # +--replace_column 10 # eval EXPLAIN EXTENDED $q; let $q= @@ -195,12 +195,12 @@ SELECT * FROM t1 set optimizer_switch='index_merge_sort_intersection=on'; eval $q; ---replace_column 9 # +--replace_column 10 # eval EXPLAIN EXTENDED $q; set optimizer_switch='index_merge_sort_intersection=off'; eval $q; ---replace_column 9 # +--replace_column 10 # eval EXPLAIN EXTENDED $q; set optimizer_switch='index_merge_sort_intersection=default'; diff --git a/mysql-test/main/range_mrr_icp.result b/mysql-test/main/range_mrr_icp.result index 6da0fc9bd68..766f3e7b318 100644 --- a/mysql-test/main/range_mrr_icp.result +++ b/mysql-test/main/range_mrr_icp.result @@ -40,8 +40,8 @@ event_date type event_id 1999-07-13 100600 26 1999-07-14 100600 10 explain select event_date,type,event_id from t1 WHERE type = 100601 and event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND (type=100600 OR type=100100) or event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND type=100099; event_date type event_id 1999-07-10 100100 24 @@ -227,49 +227,49 @@ create table t1 (x int, y int, index(x), index(y)); insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9); update t1 set y=x; explain select * from t1, t1 t2 where t1.y = 8 and t2.x between 7 and t1.y+0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref y y 5 const 1 +1 SIMPLE t2 NULL range x x 5 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 8 and t2.x >= 7 and t2.x <= t1.y+0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref y y 5 const 1 +1 SIMPLE t2 NULL range x x 5 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref y y 5 const 1 +1 SIMPLE t2 NULL range x x 5 NULL 3 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 3 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref y y 5 const 1 +1 SIMPLE t2 NULL range x x 5 NULL 3 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref y y 5 const 1 +1 SIMPLE t2 NULL range x x 5 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref y y 5 const 1 -1 SIMPLE t2 range x x 5 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref y y 5 const 1 +1 SIMPLE t2 NULL range x x 5 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) explain select count(*) from t1 where x in (1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref x x 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref x x 5 const 1 Using index explain select count(*) from t1 where x in (1,2,3,4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range x x 5 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range x x 5 NULL 4 Using where; Using index drop table t1; CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1)); INSERT INTO t1 VALUES (0),(0),(0),(0),(0),(1),(1); CREATE TABLE t2 (keya int(11) NOT NULL default '0', KEY j1 (keya)); INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2); explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref j1 j1 4 const 1 Using index -1 SIMPLE t1 range i1 i1 4 NULL 7 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref j1 j1 4 const 1 Using index +1 SIMPLE t1 NULL range i1 i1 4 NULL 7 Using where; Using index; Using join buffer (flat, BNL join) explain select * from t1 force index(i1), t2 force index(j1) where (t1.key1 <t2.keya + 1) and t2.keya=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref j1 j1 4 const 1 Using index -1 SIMPLE t1 range i1 i1 4 NULL 7 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref j1 j1 4 const 1 Using index +1 SIMPLE t1 NULL range i1 i1 4 NULL 7 Using where; Using index; Using join buffer (flat, BNL join) DROP TABLE t1,t2; CREATE TABLE t1 ( a int(11) default NULL, @@ -283,8 +283,8 @@ INSERT INTO t1 VALUES (21,4),(22,5),(23,5),(24,5),(25,5),(26,5),(30,5),(31,5),(32,5),(33,5), (33,5),(33,5),(33,5),(33,5),(34,5),(35,5); EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a,b a 5 NULL 2 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a,b a 5 NULL 2 Using index condition; Using where; Rowid-ordered scan SELECT * FROM t1 WHERE a IN(1,2) AND b=5; a b DROP TABLE t1; @@ -430,21 +430,21 @@ test.t1 analyze status OK test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uid_index uid_index 4 NULL 111 Using index condition; Rowid-ordered scan -1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 111 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uid_index uid_index 4 NULL 111 Using index condition; Rowid-ordered scan -1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 111 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uid_index uid_index 4 NULL 112 Using index condition; Rowid-ordered scan -1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 112 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uid_index uid_index 4 NULL 112 Using index condition; Rowid-ordered scan -1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 38 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 112 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; id name uid id name uid 1001 A 1 1001 A 1 @@ -593,29 +593,29 @@ create index t1i on t1(a); insert into t1 select 18446744073709551615; insert into t1 select 18446744073709551614; explain select * from t1 where a <> -1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index t1i t1i 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 Using where; Using index select * from t1 where a <> -1; a 18446744073709551614 18446744073709551615 explain select * from t1 where a > -1 or a < -1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index t1i t1i 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 Using where; Using index select * from t1 where a > -1 or a < -1; a 18446744073709551614 18446744073709551615 explain select * from t1 where a > -1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index t1i t1i 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 Using where; Using index select * from t1 where a > -1; a 18446744073709551614 18446744073709551615 explain select * from t1 where a < -1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables select * from t1 where a < -1; a drop table t1; @@ -624,17 +624,17 @@ create table t1 (a char(10), b text, key (a)) character set latin1; INSERT INTO t1 (a) VALUES ('111'),('222'),('222'),('222'),('222'),('444'),('aaa'),('AAA'),('bbb'); explain select * from t1 where a='aaa'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 11 const 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 11 const 2 Using index condition explain select * from t1 where a=binary 'aaa'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 11 const 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 11 const 2 Using index condition explain select * from t1 where a='aaa' collate latin1_bin; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 11 const 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 11 const 2 Using index condition explain select * from t1 where a='aaa' collate latin1_german1_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL a NULL NULL NULL 9 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 9 Using where drop table t1; CREATE TABLE t1 ( `CLIENT` char(3) character set latin1 collate latin1_bin NOT NULL default '000', @@ -678,8 +678,8 @@ drop table t1, t2; create table t1(a char(2), key(a(1))); insert into t1 values ('x'), ('xx'); explain select a from t1 where a > 'x'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 2 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 2 NULL 2 Using where select a from t1 where a > 'x'; a xx @@ -725,9 +725,9 @@ SELECT s.oxid FROM t1 v, t1 s WHERE v.oxrootid ='d8c4177d09f8b11f5.52725521' AND s.oxleft > v.oxleft AND s.oxleft < v.oxright; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE v ALL OXLEFT,OXRIGHT,OXROOTID NULL NULL NULL 12 Using where -1 SIMPLE s ALL OXLEFT NULL NULL NULL 12 Range checked for each record (index map: 0x4) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE v NULL ALL OXLEFT,OXRIGHT,OXROOTID NULL NULL NULL 12 Using where +1 SIMPLE s NULL ALL OXLEFT NULL NULL NULL 12 Range checked for each record (index map: 0x4) SELECT s.oxid FROM t1 v, t1 s WHERE v.oxrootid ='d8c4177d09f8b11f5.52725521' AND @@ -905,11 +905,11 @@ INSERT INTO t1 VALUES (55,'C'), (56,'C'), (57,'C'), (58,'C'), (59,'C'), (60,'C'); INSERT INTO t1(status) SELECT status FROM t1; EXPLAIN SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 18 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 Using index condition; Rowid-ordered scan EXPLAIN SELECT * FROM t1 WHERE status NOT IN ('A','B'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 18 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B'; id status 53 C @@ -947,17 +947,17 @@ id status 119 C 120 C EXPLAIN SELECT status FROM t1 WHERE status <> 'A' AND status <> 'B'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 18 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 Using where; Using index EXPLAIN SELECT status FROM t1 WHERE status NOT IN ('A','B'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 18 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 17 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range status status 23 NULL 17 Using index condition; Rowid-ordered scan EXPLAIN SELECT * FROM t1 WHERE status < 'A' OR status > 'B'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range status status 23 NULL 17 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range status status 23 NULL 17 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B'; id status 53 C @@ -1000,17 +1000,17 @@ INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3),(4,1),(4,2),(4,3); CREATE VIEW v1 as SELECT a,b FROM t1 WHERE b=3; EXPLAIN SELECT a,b FROM t1 WHERE a < 2 and b=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 Using where; Using index EXPLAIN SELECT a,b FROM v1 WHERE a < 2 and b=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 Using where; Using index EXPLAIN SELECT a,b FROM t1 WHERE a < 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 Using where; Using index EXPLAIN SELECT a,b FROM v1 WHERE a < 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 Using where; Using index SELECT a,b FROM t1 WHERE a < 2 and b=3; a b 1 3 @@ -1049,17 +1049,17 @@ INSERT INTO `t1` VALUES (0,0),(1,0),(2,0),(3,0),(4,0),(5,1),(6,1),(7,1),(8,1),(9,1),(10,2),(11,2),(12,2) ,(13,2),(14,2),(15,3),(16,3),(17,3),(18,3),(19,3); explain select * from t1 where a in (3,4) and b in (1,2,3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # Using where; Using index explain select * from v1 where a in (3,4) and b in (1,2,3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # Using where; Using index explain select * from t1 where a between 3 and 4 and b between 1 and 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # Using where; Using index explain select * from v1 where a between 3 and 4 and b between 1 and 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # Using where; Using index drop view v1; drop table t1; create table t3 (a int); @@ -1073,21 +1073,21 @@ insert into t1 select concat('a', 1000 + A.a + 10 * (B.a + 10 * C.a)), '' create table t2 (a varchar(10), filler char(200), key(a)); insert into t2 select * from t1; explain select * from t1 where a between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 13 NULL # Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 13 NULL # Using index condition; Rowid-ordered scan explain select * from t1 where a = 'a' or a='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 13 NULL # Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 13 NULL # Using index condition; Rowid-ordered scan explain select * from t2 where a between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 13 const # Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref a a 13 const # Using index condition explain select * from t2 where a = 'a' or a='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 13 const # Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref a a 13 const # Using index condition update t1 set a='b' where a<>'a'; explain select * from t1 where a not between 'b' and 'b'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 13 NULL # Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 13 NULL # Using index condition; Rowid-ordered scan select a, hex(filler) from t1 where a not between 'b' and 'b'; a hex(filler) a 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -1108,11 +1108,11 @@ id b c 0 3 4 0 3 4 EXPLAIN SELECT * FROM t1 WHERE b<=3 AND 3<=c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx2 idx2 4 NULL 2 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1,idx2 idx2 4 NULL 2 Using index condition; Using where; Rowid-ordered scan EXPLAIN SELECT * FROM t1 WHERE 3 BETWEEN b AND c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx2 idx2 4 NULL 2 Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1,idx2 idx2 4 NULL 2 Using where; Rowid-ordered scan SELECT * FROM t1 WHERE 0 < b OR 0 > c; id b c 0 3 4 @@ -1122,11 +1122,11 @@ id b c 0 3 4 0 3 4 EXPLAIN SELECT * FROM t1 WHERE 0 < b OR 0 > c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge idx1,idx2 idx1,idx2 4,4 NULL 3 Using sort_union(idx1,idx2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge idx1,idx2 idx1,idx2 4,4 NULL 3 Using sort_union(idx1,idx2); Using where EXPLAIN SELECT * FROM t1 WHERE 0 NOT BETWEEN b AND c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge idx1,idx2 idx1,idx2 4,4 NULL 3 Using sort_union(idx1,idx2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge idx1,idx2 idx1,idx2 4,4 NULL 3 Using sort_union(idx1,idx2); Using where DROP TABLE t1; CREATE TABLE t1 ( item char(20) NOT NULL default '', @@ -1140,8 +1140,8 @@ INSERT INTO t1 VALUES ('A1','2005-12-12 08:00:00',3000), ('A2','2005-12-01 08:00:00',1000); EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 20 const 3 Using index condition SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; item started price Warnings: @@ -1152,8 +1152,8 @@ A1 2005-11-01 08:00:00 1000.000 A1 2005-11-15 00:00:00 2000.000 DROP INDEX `PRIMARY` ON t1; EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; item started price Warnings: @@ -1178,8 +1178,8 @@ INSERT INTO t1 VALUES (9,'2007-01-09'),(10,'2007-01-10'),(11,'2007-01-11'); This must use range access: explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '2007-01-02 23:59:59'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range dateval dateval 4 NULL 2 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range dateval dateval 4 NULL 2 Using index condition; Rowid-ordered scan drop table t1; CREATE TABLE t1 ( a varchar(32), index (a) @@ -1192,8 +1192,8 @@ a B B EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 35 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 35 NULL 3 Using where; Using index DROP TABLE t1; CREATE TABLE t1 (f1 TINYINT(11) UNSIGNED NOT NULL, PRIMARY KEY (f1)); INSERT INTO t1 VALUES (127),(254),(0),(1),(255); @@ -1245,8 +1245,8 @@ select 'In following EXPLAIN the access method should be ref, #rows~=500 (and no Z In following EXPLAIN the access method should be ref, #rows~=500 (and not 2) explain select * from t2 where a=1000 and b<11; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref a a 5 const 503 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref a a 5 const 503 Using index condition drop table t1, t2; CREATE TABLE t1( a INT, b INT, KEY( a, b ) ); CREATE TABLE t2( a INT, b INT, KEY( a, b ) ); @@ -1285,8 +1285,8 @@ SELECT * FROM t1 WHERE 23 <= a AND a < 25 OR 25 < a AND b = 23 OR 23 <= a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 Using where; Using index SELECT * FROM t1 WHERE 23 <= a AND a < 25 OR 25 <= a AND b = 23 OR @@ -1299,8 +1299,8 @@ SELECT * FROM t1 WHERE 23 <= a AND a < 25 OR 25 <= a AND b = 23 OR 23 <= a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 3 Using where; Using index SELECT * FROM t1 WHERE 23 <= a AND a <= 25 OR 25 <= a AND b = 23 OR @@ -1313,8 +1313,8 @@ SELECT * FROM t1 WHERE 23 <= a AND a <= 25 OR 25 <= a AND b = 23 OR 23 <= a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 Using where; Using index SELECT * FROM t1 WHERE 23 <= a AND a <= 25 OR 23 <= a; @@ -1325,8 +1325,8 @@ EXPLAIN SELECT * FROM t1 WHERE 23 <= a AND a <= 25 OR 23 <= a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 Using where; Using index SELECT * FROM t2 WHERE 5 <= a AND a < 10 AND b = 1 OR 15 <= a AND a < 20 AND b = 3 @@ -1364,8 +1364,8 @@ SELECT * FROM t2 WHERE 15 <= a AND a < 20 AND b = 3 OR 1 <= a AND b = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 10 NULL 49 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 10 NULL 49 Using where; Using index SELECT * FROM t2 WHERE 5 <= a AND a < 10 AND b = 2 OR 15 <= a AND a < 20 AND b = 3 @@ -1408,8 +1408,8 @@ SELECT * FROM t2 WHERE 15 <= a AND a < 20 AND b = 3 OR 1 <= a AND b = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 10 NULL 49 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 10 NULL 49 Using where; Using index SELECT * FROM t3 WHERE 5 <= a AND a < 10 AND b = 3 OR a < 5 OR @@ -1429,8 +1429,8 @@ SELECT * FROM t3 WHERE 5 <= a AND a < 10 AND b = 3 OR a < 5 OR a < 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range a a 5 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL range a a 5 NULL 9 Using where; Using index DROP TABLE t1, t2, t3; # # Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN @@ -1461,8 +1461,8 @@ INSERT INTO t2 VALUES ('2009-09-21 12:00:00'), ('2009-09-21 12:00:00'), # DATE vs DATE EXPLAIN SELECT * FROM t1 WHERE a >= '2009/09/23'; -id select_type table type possible_keys key key_len ref rows Extra -X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows Extra +X X X X range a a X X X X SELECT * FROM t1 WHERE a >= '2009/09/23'; a 2009-09-23 @@ -1496,8 +1496,8 @@ a # DATE vs DATETIME EXPLAIN SELECT * FROM t2 WHERE a >= '2009/09/23'; -id select_type table type possible_keys key key_len ref rows Extra -X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows Extra +X X X X range a a X X X X SELECT * FROM t2 WHERE a >= '2009/09/23'; a 2009-09-23 12:00:00 @@ -1536,8 +1536,8 @@ a # DATETIME vs DATETIME EXPLAIN SELECT * FROM t2 WHERE a >= '2009/09/23 12:00:00'; -id select_type table type possible_keys key key_len ref rows Extra -X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows Extra +X X X X range a a X X X X SELECT * FROM t2 WHERE a >= '2009/09/23 12:00:00'; a 2009-09-23 12:00:00 @@ -1571,8 +1571,8 @@ a # DATETIME vs DATE EXPLAIN SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00'; -id select_type table type possible_keys key key_len ref rows Extra -X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows Extra +X X X X range a a X X X X SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00'; a 2009-09-23 @@ -1685,8 +1685,8 @@ INSERT INTO t1 VALUES (0,0), (1,1); EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE (a>=1 AND a<=2) OR (a>=4 AND a<=5) OR (a>=0 AND a <=10); -id select_type table type possible_keys key key_len ref rows Extra -@ @ @ range @ @ @ @ @ @ +id select_type table partitions type possible_keys key key_len ref rows Extra +@ @ @ @ range @ @ @ @ @ @ # Should return 2 rows SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE (a>=1 AND a<=2) OR (a>=4 AND a<=5) OR (a>=0 AND a <=10); @@ -1700,8 +1700,8 @@ DROP TABLE t1; CREATE TABLE t1 (c_key INT, c_notkey INT, KEY(c_key)); INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3); EXPLAIN SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL c_key NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL c_key NULL NULL NULL 3 Using where SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key; c_key c_notkey 1 1 @@ -1716,37 +1716,37 @@ INSERT INTO t1 VALUES (1,10), (2,20), (3,30), (4,40), (5,50), (6,60), (7,70), (8,80); EXPLAIN SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const i4_uq i4_uq 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const i4_uq i4_uq 5 const 1 SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 10; pk i4 1 10 EXPLAIN SELECT * FROM t1 WHERE 10 BETWEEN i4 AND i4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const i4_uq i4_uq 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const i4_uq i4_uq 5 const 1 SELECT * FROM t1 WHERE 10 BETWEEN i4 AND i4; pk i4 1 10 EXPLAIN SELECT * FROM t1 WHERE 70 BETWEEN 70 AND i4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range i4_uq i4_uq 5 NULL 2 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 2 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE 70 BETWEEN 70 AND i4; pk i4 7 70 8 80 EXPLAIN SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range i4_uq i4_uq 5 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10; pk i4 1 10 EXPLAIN SELECT * FROM t1 WHERE 10 BETWEEN 10 AND 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 SELECT * FROM t1 WHERE 10 BETWEEN 10 AND 10; pk i4 1 10 @@ -1759,56 +1759,56 @@ pk i4 8 80 EXPLAIN SELECT * FROM t1 WHERE 10 BETWEEN 11 AND 11; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT * FROM t1 WHERE 10 BETWEEN 11 AND 11; pk i4 EXPLAIN SELECT * FROM t1 WHERE 10 BETWEEN 100 AND 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT * FROM t1 WHERE 10 BETWEEN 100 AND 0; pk i4 EXPLAIN SELECT * FROM t1 WHERE i4 BETWEEN 100 AND 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 WHERE i4 BETWEEN 100 AND 0; pk i4 EXPLAIN SELECT * FROM t1 WHERE i4 BETWEEN 70 AND 99999999999999999; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range i4_uq i4_uq 5 NULL 2 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 2 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE i4 BETWEEN 70 AND 99999999999999999; pk i4 7 70 8 80 EXPLAIN SELECT * FROM t1 WHERE i4 BETWEEN 999999999999999 AND 30; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 WHERE i4 BETWEEN 999999999999999 AND 30; pk i4 EXPLAIN SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range i4_uq i4_uq 5 NULL 2 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 2 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20'; pk i4 1 10 2 20 EXPLAIN SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL i4_uq NULL NULL NULL 8 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL i4_uq NULL NULL NULL 8 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 Using index condition SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4; pk i4 pk i4 EXPLAIN SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL i4_uq NULL NULL NULL 8 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL i4_uq NULL NULL NULL 8 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 Using index condition SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk; pk i4 pk i4 DROP TABLE t1; @@ -1956,9 +1956,9 @@ insert into t2 select a+64 from t2; explain select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 between 920 and 930) and t1.key2 < 1000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 64 -1 SIMPLE t1 range i1,i2 i1 4 NULL 12 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 64 +1 SIMPLE t1 NULL range i1,i2 i1 4 NULL 12 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 between 920 and 930) and t1.key2 < 1000; count(*) @@ -1966,9 +1966,9 @@ count(*) explain select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 between 920 and 930) and t1.key2 < t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 64 -1 SIMPLE t1 range i1,i2 i1 4 NULL 12 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 64 +1 SIMPLE t1 NULL range i1,i2 i1 4 NULL 12 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 between 920 and 930) and t1.key2 < t2.a; count(*) @@ -1983,8 +1983,8 @@ create table t1 (a int, b int, c int, key idx (a,b,c)); insert into t1 values (0,0,0), (2,2,0), (1,1,1), (2,2,1); explain select * from t1 force index (idx) where a >=1 and c <= 1 and a=b and b > 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 2 Using where; Using index select * from t1 force index (idx) where a >=1 and c <= 1 and a=b and b > 1; a b c 2 2 0 @@ -2013,8 +2013,8 @@ INSERT INTO t100(I,J) SELECT X.I, X.K+(10*Y.K) FROM t10 AS X,t10 AS Y; INSERT INTO t100(I,J) VALUES(8,26); EXPLAIN SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t100 range I I 10 NULL 3 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t100 NULL range I I 10 NULL 3 Using index condition; Rowid-ordered scan SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5); K I J @@ -2118,14 +2118,14 @@ INSERT INTO t1 (fd) SELECT fd FROM t1; # The following should show "Impossible WHERE" : explain SELECT * FROM t1 WHERE fd='😁'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 WHERE fd='😁'; id fd # The following must not use range access: explain select count(*) from t1 where fd <'😁'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ix_fd ix_fd 63 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index ix_fd ix_fd 63 NULL # Using where; Using index select count(*) from t1 where fd <'😁'; count(*) 40960 @@ -2188,8 +2188,8 @@ CREATE TABLE t1 (a INT, INDEX(a)); INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); explain SELECT * FROM t1 WHERE a > 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 4 Using where; Using index SELECT * FROM t1 WHERE a > 5; a 6 @@ -2227,8 +2227,8 @@ INSERT INTO t2 VALUES ('2001-01-01 11:22:33'); # range/ref access cannot be used for this query EXPLAIN SELECT * FROM t2 WHERE b=CAST('2001-01-01' AS DATE); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b b 67 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index b b 67 NULL 5 Using where; Using index SELECT * FROM t2 WHERE b=CAST('2001-01-01' AS DATE); b 2001#01#01 @@ -2240,9 +2240,9 @@ b # See BUG#13814468 about 'Range checked for each record' EXPLAIN SELECT * FROM t1, t2 WHERE a=b ORDER BY BINARY a, BINARY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -1 SIMPLE t2 ALL b NULL NULL NULL 5 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL b NULL NULL NULL 5 Range checked for each record (index map: 0x1) SELECT * FROM t1, t2 WHERE a=b ORDER BY BINARY a, BINARY b; a b 2001-01-01 00:00:00 2001#01#01 @@ -2252,9 +2252,9 @@ a b 2001-01-01 11:22:33 2001-01-01 11:22:33 EXPLAIN SELECT * FROM t1, t2 WHERE b=a ORDER BY BINARY a, BINARY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -1 SIMPLE t2 ALL b NULL NULL NULL 5 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL b NULL NULL NULL 5 Range checked for each record (index map: 0x1) SELECT * FROM t1, t2 WHERE b=a ORDER BY BINARY a, BINARY b; a b 2001-01-01 00:00:00 2001#01#01 @@ -2274,26 +2274,26 @@ insert into t2 select A.a + B.a* 10 + C.a * 100 from t1 A, t1 B, t1 C; alter table t2 add key(a); # Should have "range checked for each table" for second table: explain select * from t1, t2 where t2.a < t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 -1 SIMPLE t2 ALL a NULL NULL NULL 1000 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 NULL ALL a NULL NULL NULL 1000 Range checked for each record (index map: 0x1) # Should have "range checked for each table" for second table: explain select * from t1, t2 where t1.a > t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 -1 SIMPLE t2 ALL a NULL NULL NULL 1000 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 NULL ALL a NULL NULL NULL 1000 Range checked for each record (index map: 0x1) create table t3 (a int primary key, b int); insert into t3 select a,a from t1; # The second table should use 'range': explain select * from t3, t2 where t2.a < t3.b and t3.a=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range a a 5 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range a a 5 NULL 1 Using where; Using index # The second table should use 'range': explain select * from t3, t2 where t3.b > t2.a and t3.a=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range a a 5 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range a a 5 NULL 1 Using where; Using index drop table t1,t2,t3; # # MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE. @@ -2310,33 +2310,33 @@ from t1 A, t1 B, t1 C; # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: explain extended select * from t2 where (b > 25 and b < 15) or a<44; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a,b a 5 NULL 43 100.00 Using index condition; Rowid-ordered scan Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`a` < 44 # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: explain extended select * from t2 where a < 44 or (b > 25 and b < 15); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a,b a 5 NULL 43 100.00 Using index condition; Rowid-ordered scan Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`a` < 44 # Here, conditions b will not be removed, because "c<44" is not sargable # and hence (b.. and .. b) part is not analyzed at all: explain extended select * from t2 where c < 44 or (b > 25 and b < 15); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL b NULL NULL NULL 1000 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` < 44 or `test`.`t2`.`b` > 25 and `test`.`t2`.`b` < 15 # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: explain extended select * from t2 where (b > 25 and b < 15) or c < 44; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL b NULL NULL NULL 1000 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` < 44 # Try a case where both OR parts produce SEL_ARG::IMPOSSIBLE: explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 44 AS `a`,15 AS `b`,NULL AS `c` from `test`.`t2` where 0 drop table t1,t2; @@ -2349,11 +2349,11 @@ drop table t1,t2; CREATE TABLE t1 (a INT, b INT, KEY(a)); INSERT INTO t1 (a) VALUES (10),(10),(10),(10),(10),(10),(10),(10),(10),(10),(70); EXPLAIN SELECT * FROM t1 WHERE a<>10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 Using index condition; Rowid-ordered scan EXPLAIN SELECT * FROM t1 WHERE 10<>a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 2 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE a<>10; a b 70 NULL @@ -2368,8 +2368,8 @@ SET NAMES utf8; CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8, KEY(a)) ENGINE=MyISAM; INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e'); EXPLAIN SELECT * FROM t1 WHERE a<=>'😎'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t1; # # MDEV-10185: Assertion `tree1->keys[key_no] && tree2->keys[key_no]' failed in @@ -2408,8 +2408,8 @@ insert into t1 values (82,12,'wxa'), (85,15,'xd'); # range access to t1 by 2-component keys for index idx explain select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 10 NULL 6 Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 10 NULL 6 Using where; Rowid-ordered scan explain format=json select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7)); EXPLAIN { @@ -2473,8 +2473,8 @@ a b c deallocate prepare stmt; # range access to t1 by 1-component keys for index idx explain select * from t1 where (a,b+a) IN ((4,9),(8,8),(7,7)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 5 Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 5 Using where; Rowid-ordered scan explain format=json select * from t1 where (a,b+a) IN ((4,9),(8,8),(7,7)); EXPLAIN { @@ -2504,8 +2504,8 @@ a b c 4 5 wa # range access to t1 by 1-component keys for index idx explain select * from t1 where (a,b) IN ((4,a-1),(8,a+8),(7,a+7)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 5 Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 5 Using where; Rowid-ordered scan explain format=json select * from t1 where (a,b) IN ((4,a-1),(8,a+8),(7,a+7)); EXPLAIN { @@ -2547,9 +2547,9 @@ insert into t2 values # range access to t1 by keys for index idx1 explain select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(2,2)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx1,idx2 idx1 5 NULL 3 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE t1 ref idx idx 5 test.t2.d 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx1,idx2 idx1 5 NULL 3 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 8 explain format=json select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(2,2)); EXPLAIN @@ -2626,9 +2626,9 @@ insert into t2 values # range access to t1 by 1-component keys for index idx explain select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx1,idx2 idx1 5 NULL 8 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE t1 ref idx idx 5 test.t2.d 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx1,idx2 idx1 5 NULL 8 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 8 explain format=json select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1; EXPLAIN @@ -2730,9 +2730,9 @@ insert into t1 select * from t1; # range access to t2 by keys for index idx2 explain select * from t1,t2 where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx1,idx2 idx1 5 NULL 7 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE t1 ref idx idx 5 test.t2.d 11 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx1,idx2 idx1 5 NULL 7 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 11 explain format=json select * from t1,t2 where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1; EXPLAIN @@ -2787,9 +2787,9 @@ alter table t2 drop index idx1, drop index idx2, add index idx3(d,e); # range access to t2 by 2-component keys for index idx3 explain select * from t1,t2 where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range idx3 idx3 10 NULL 5 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE t1 ref idx idx 5 test.t2.d 11 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range idx3 idx3 10 NULL 5 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 11 explain format=json select * from t1,t2 where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1; EXPLAIN @@ -2843,9 +2843,9 @@ a b c d e f # range access to t1 by 1-component keys for index idx explain select * from t1,t2 where a = d and (a,e) in ((4,d+1),(7,d+1),(8,d+1)) and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 15 Using index condition; Rowid-ordered scan -1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 15 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 Using where explain format=json select * from t1,t2 where a = d and (a,e) in ((4,d+1),(7,d+1),(8,d+1)) and length(f) = 1; EXPLAIN @@ -2907,9 +2907,9 @@ a b c d e f # no range access explain select * from t1,t2 where a = d and (a,e) in ((e,d+1),(7,7),(8,8)) and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL idx NULL NULL NULL 144 Using where -1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 144 Using where +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 Using where explain format=json select * from t1,t2 where a = d and (a,e) in ((e,d+1),(7,7),(8,8)) and length(f) = 1; EXPLAIN @@ -2960,9 +2960,9 @@ a b c d e f explain select * from t1,t2 where a = d and (a,2) in ((2,2),(7,7),(8,8)) and length(c) = 1 and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 12 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 12 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 Using where explain format=json select * from t1,t2 where a = d and (a,2) in ((2,2),(7,7),(8,8)) and length(c) = 1 and length(f) = 1; @@ -3042,10 +3042,10 @@ explain select * from t1,t2,t3 where id = 1 and a = d and (a,v+1) in ((2,2),(7,7),(8,8)) and length(c) = 1 and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t1 range idx idx 5 NULL 12 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE t2 ref idx3 idx3 5 test.t1.a 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t1 NULL range idx idx 5 NULL 12 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 Using where explain format=json select * from t1,t2,t3 where id = 1 and a = d and (a,v+1) in ((2,2),(7,7),(8,8)) and @@ -3116,8 +3116,8 @@ explain select * from t1,t2,t3 where id = 1 and a = d and (a,v+1) in ((9,9),(7,7),(8,8)) and length(c) = 1 and length(f) = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables prepare stmt from "select * from t1,t2,t3 where id = 1 and a = d and (a,v+1) in ((9,9),(7,7),(8,8)) and @@ -3149,8 +3149,8 @@ rec_per_key 2 set eq_range_index_dive_limit=0; explain select * from t1 where a in (8, 15, 31, 1, 9); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 7 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 7 Using index condition; Rowid-ordered scan select * from t1 where a in (8, 15, 31, 1, 9); a b 1 yy @@ -3160,8 +3160,8 @@ a b 15 ffffzz set eq_range_index_dive_limit=2; explain select * from t1 where a in (8, 15, 31, 1, 9); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 5 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 5 Using index condition; Rowid-ordered scan select * from t1 where a in (8, 15, 31, 1, 9); a b 1 yy @@ -3199,8 +3199,8 @@ set @query=concat('explain select * from t2 where a=1 or a in (', @query, ')'); prepare s from @query; # This should not fail with an error: execute s; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL a NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 3 Using where set max_session_mem_used=@tmp_24117; deallocate prepare s; drop table t0,t1,t2; @@ -3225,8 +3225,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1 where ((a between 3 and 4) and b < 100) or (a between 2 and 5); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where; Rowid-ordered scan select * from t1 where ((a between 3 and 4) and b < 100) or (a between 2 and 5); pk a b 1 5 50 @@ -3238,8 +3238,8 @@ pk a b 70 4 40 71 2 20 explain select * from t1 where (a between 2 and 5) or ((a between 3 and 4) and b < 100); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where; Rowid-ordered scan select * from t1 where (a between 2 and 5) or ((a between 3 and 4) and b < 100); pk a b 1 5 50 @@ -3251,8 +3251,8 @@ pk a b 70 4 40 71 2 20 explain select * from t1 where (a between 3 and 4) or ((a between 2 and 5) and b < 100); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where; Rowid-ordered scan select * from t1 where (a between 3 and 4) or ((a between 2 and 5) and b < 100); pk a b 1 5 50 @@ -3264,8 +3264,8 @@ pk a b 70 4 40 71 2 20 explain select * from t1 where ((a between 2 and 5) and b < 100) or (a between 3 and 4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 Using index condition; Using where; Rowid-ordered scan select * from t1 where ((a between 2 and 5) and b < 100) or (a between 3 and 4); pk a b 1 5 50 @@ -3289,8 +3289,8 @@ insert into t2 (pk, key1) select A.a+10 *B.a + 100*C.a, A.a+10 *B.a +100*C.a from t1 A, t1 B, t1 C; # This must use ALL, not range: explain select * from t2 force index (primary) where pk not in (1,2,3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1000 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 1000 Using where drop table t1,t2; # # MDEV-24444: ASAN use-after-poison in Item_func_in::get_func_mm_tree with NOT IN @@ -3310,8 +3310,8 @@ create table t1 (pk int primary key, a int); insert into t1 (pk) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); # must not use range: explain select * from t1 force index (primary) where pk != 1 and pk!=2 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 10 Using where drop table t1; # # MDEV-22251: get_key_scans_params: Conditional jump or move depends on uninitialised value @@ -3322,9 +3322,9 @@ create table t2 (a int, b int); insert into t2 values (1,2),(2,4); EXPLAIN select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 -1 SIMPLE t1 ALL PRIMARY,v NULL NULL NULL 8 Range checked for each record (index map: 0x3) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 NULL ALL PRIMARY,v NULL NULL NULL 8 Range checked for each record (index map: 0x3) select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk); pk i v a b 1 1 2 1 2 @@ -3369,13 +3369,13 @@ create table t2(a int, key(a)); insert into t2 select A.a + B.a*10 + C.a*100 from ten A, ten B,ten C where A.a + B.a*10 + C.a*100 < 199; # expected type=range, rows=1487 , reason=using index dives analyze SELECT * FROM t1 where a in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 range a a 5 NULL 1487 1199.00 100.00 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 1487 1199.00 100.00 100.00 Using where; Using index insert into t2 values (200),(201); # expected type=range, rows=201 , reason=using index statistics analyze SELECT * FROM t1 where a in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 range a a 5 NULL 201 1201.00 100.00 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 201 1201.00 100.00 100.00 Using where; Using index drop table t1,ten,t2; # End of 10.4 tests # @@ -3407,9 +3407,9 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date # expected for t1: range access and rows = 4 (not 1000) explain SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan -1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id; id subset_id id col 0 0 0 0 @@ -3420,9 +3420,9 @@ id subset_id id col # with a subquery # expected the same plan as above explain SELECT * FROM t1 WHERE t1.subset_id IN (SELECT t2.id FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan -1 PRIMARY t2 ref id id 5 test.t1.subset_id 1 Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan +1 PRIMARY t2 NULL ref id id 5 test.t1.subset_id 1 Using index; FirstMatch(t1) SELECT * FROM t1 WHERE t1.subset_id IN (SELECT t2.id FROM t2); id subset_id 0 0 @@ -3434,10 +3434,10 @@ id subset_id # expected for t1: range access and rows = 4 (not 1000) explain SELECT * FROM t1 WHERE t1.subset_id IN (SELECT max(t2.id) FROM t2 group by t2.col); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1.subset_id 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 1000 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t1.subset_id 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1000 Using temporary SELECT * FROM t1 WHERE t1.subset_id IN (SELECT max(t2.id) FROM t2 group by t2.col); id subset_id @@ -3451,9 +3451,9 @@ create view v2 as SELECT t2.id FROM t2 group by t2.col; # with mergeable view # expected for t1: range access and rows = 4 (not 1000) explain SELECT * FROM t1, v1 where t1.subset_id=v1.id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan -1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 Using index SELECT * FROM t1, v1 where t1.subset_id=v1.id; id subset_id id 0 0 0 @@ -3464,10 +3464,10 @@ id subset_id id # with non-mergeable view # expected for t1: range access and rows = 4 (not 1000) explain SELECT * FROM t1, v2 where t1.subset_id=v2.id; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan -1 PRIMARY <derived2> ref key0 key0 5 test.t1.subset_id 10 -2 DERIVED t2 ALL NULL NULL NULL NULL 1000 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.subset_id 10 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 1000 Using temporary; Using filesort SELECT * FROM t1, v2 where t1.subset_id=v2.id; id subset_id id 0 0 0 @@ -3477,9 +3477,9 @@ id subset_id id 4 4 4 # expected for t2 and for t1: range access explain SELECT * FROM t2 LEFT JOIN t1 ON t1.subset_id != 5 WHERE t2.id in (0,2,4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range id id 5 NULL 3 Using index condition; Rowid-ordered scan -1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 4 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range id id 5 NULL 3 Using index condition; Rowid-ordered scan +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 4 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) SELECT * FROM t2 LEFT JOIN t1 ON t1.subset_id != 5 WHERE t2.id in (0,2,4); id col id subset_id 0 0 0 0 @@ -3499,9 +3499,9 @@ id col id subset_id 4 4 4 4 # no range access expected for t1 explain SELECT * FROM t1 LEFT JOIN t2 ON t1.subset_id=t2.id LIMIT 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 -1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 Using where SELECT * FROM t1 LEFT JOIN t2 ON t1.subset_id=t2.id LIMIT 10; id subset_id id col 0 0 0 0 @@ -3516,10 +3516,10 @@ id subset_id id col 9 NULL NULL NULL # expected for t1: range access explain SELECT * FROM ten LEFT JOIN (t1,t2) ON ten.a=t2.col AND t1.subset_id=t2.id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE ten ALL NULL NULL NULL NULL 10 -1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using where; Rowid-ordered scan -1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE ten NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 Using where; Rowid-ordered scan +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 Using where SELECT * FROM ten LEFT JOIN (t1,t2) ON ten.a=t2.col AND t1.subset_id=t2.id; a id subset_id id col 0 0 0 0 0 @@ -3535,10 +3535,10 @@ a id subset_id id col # no range access expected for t1 explain SELECT * FROM t1 LEFT JOIN (t2,ten) ON ten.a=t2.col AND t1.subset_id=t2.id LIMIT 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 -1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 Using where -1 SIMPLE ten ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 Using where +1 SIMPLE ten NULL ALL NULL NULL NULL NULL 10 Using where SELECT * FROM t1 LEFT JOIN (t2,ten) ON ten.a=t2.col AND t1.subset_id=t2.id LIMIT 10; id subset_id id col a @@ -3555,9 +3555,9 @@ id subset_id id col a drop index id on t2; # expected for t1: range access explain SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan -1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1000 Using where; Using join buffer (flat, BNL join) SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id; id subset_id id col 0 0 0 0 @@ -3567,14 +3567,14 @@ id subset_id id col 4 4 4 4 # expected impossible where after reading const tables explain SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t1.subset_id IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t1.subset_id IS NULL; id subset_id id col # expected impossible where after reading const tables explain SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t2.id IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1,t2 WHERE t1.subset_id > t2.id AND t2.id IS NULL; id subset_id id col drop index t1_subset_id on t1; @@ -3590,9 +3590,9 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date # expected for t1: range access by idx (keylen=9) explain SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id and t1.m=0 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 9 NULL 4 Using index condition; Rowid-ordered scan -1 SIMPLE t2 ref id id 5 test.t1.subset_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 9 NULL 4 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 SELECT * FROM t1,t2 WHERE t1.subset_id=t2.id and t1.m=0 ; id subset_id m id col 0 0 0 0 0 @@ -3623,9 +3623,9 @@ test.t2 analyze status Table is already up to date # expected for t1 :range access by index key1 # rows 4 instead of 500 explain SELECT * FROM t1,t2 WHERE t1.id>=1 and t1.subset_id=t2.id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range key1,t1_subset_id key1 9 NULL 3 Using where; Using index -1 SIMPLE t2 ref id id 4 test.t1.subset_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range key1,t1_subset_id key1 9 NULL 3 Using where; Using index +1 SIMPLE t2 NULL ref id id 4 test.t1.subset_id 1 SELECT * FROM t1,t2 WHERE t1.id>=1 and t1.subset_id=t2.id; id subset_id id col 1 0 0 0 @@ -3649,9 +3649,9 @@ test.t2 analyze status OK # using key1 for range access on t1 and also using index for sorting, # no filesort, rows should be 75 not 500 explain SELECT * FROM t1,t2 WHERE t1.id=t2.id AND t1.col=2 ORDER BY t2.id LIMIT 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range key1 key1 5 NULL 74 Using index condition; Using where -1 SIMPLE t2 ref id id 5 test.t1.id 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 74 Using index condition; Using where +1 SIMPLE t2 NULL ref id id 5 test.t1.id 2 SELECT * FROM t1,t2 WHERE t1.id=t2.id AND t1.col=2 ORDER BY t2.id LIMIT 10; id col id col 0 2 0 0 @@ -3678,8 +3678,8 @@ CREATE TABLE t2 (pk INT, b INT, PRIMARY KEY(pk)); INSERT INTO t2 VALUES (1,1),(2,2); SET optimizer_switch = 'not_null_range_scan=on'; EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON a = pk WHERE b >= 0 AND pk IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select NULL AS `a`,0 AS `pk`,NULL AS `b` from `test`.`t1` join `test`.`t2` where 0 SELECT * FROM t1 LEFT JOIN t2 ON a = pk WHERE b >= 0 AND pk IS NULL; diff --git a/mysql-test/main/range_notembedded.result b/mysql-test/main/range_notembedded.result index eeab230e72f..0a94dec1c09 100644 --- a/mysql-test/main/range_notembedded.result +++ b/mysql-test/main/range_notembedded.result @@ -12,8 +12,8 @@ insert into t2 (pk, key1) values (1,1),(2,2),(3,3),(4,4),(5,5); set @tmp_21958=@@optimizer_trace; set optimizer_trace=1; explain select * from t2 where key1 in (1,2,3) and pk not in (1,2,3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY,key1 key1 5 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range PRIMARY,key1 key1 5 NULL 3 Using index condition # This should show only ranges in form "(1) <= (key1) <= (1)" # ranges over "pk" should not be constructed. select json_detailed(JSON_EXTRACT(trace, '$**.ranges')) @@ -61,8 +61,8 @@ kp2 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) and kp3 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) and kp4 in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index key1 key1 20 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index key1 key1 20 NULL 3 Using where; Using index set @json= (select json_detailed(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) from information_schema.optimizer_trace); # This will show 3-component ranges. @@ -95,8 +95,8 @@ kp2 in (1,2,3,4,5,6,7,8,9,10) and kp3 in (1,2,3,4,5,6,7,8,9,10) and kp4 in (1,2,3,4,5,6,7,8,9,10) ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index key1 key1 20 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index key1 key1 20 NULL 3 Using where; Using index set @trace= (select trace from information_schema.optimizer_trace); set @json= json_detailed(json_extract(@trace, '$**.range_scan_alternatives')); select left(@json, 500); @@ -166,8 +166,8 @@ kp2 in (1,2,3,4,5,6,7,8,9,10) and kp3 in (1,2,3,4,5,6,7,8,9,10) and kp4 in (1,2,3,4,5,6,7,8,9,10) ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index key1 key1 20 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index key1 key1 20 NULL 3 Using where; Using index set @json= (select json_detailed(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) from information_schema.optimizer_trace); select left(@json, 1500); @@ -236,8 +236,8 @@ PRIMARY KEY (notification_type_id,item_id,item_parent_id,user_id) ); insert into t1 values (1,1,1,1), (2,2,2,2), (3,3,3,3); # Run crashing query -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 2 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 2 NULL 3 Using where drop table t1; # # MDEV-25069: Assertion `root->weight >= ...' failed in SEL_ARG::tree_delete #2 diff --git a/mysql-test/main/range_vs_index_merge.result b/mysql-test/main/range_vs_index_merge.result index 1729b95a105..c9704ab90bc 100644 --- a/mysql-test/main/range_vs_index_merge.result +++ b/mysql-test/main/range_vs_index_merge.result @@ -40,56 +40,56 @@ set session optimizer_switch='index_merge_sort_intersection=off'; EXPLAIN SELECT * FROM City WHERE (Population >= 100000 OR Name LIKE 'P%' OR Population < 100000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL Population,Name NULL NULL NULL 4079 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL Population,Name NULL NULL NULL 4079 Using where EXPLAIN SELECT * FROM City WHERE (Population >= 100000 OR Name LIKE 'P%') AND Country='CAN' OR (Population < 100000 OR Name Like 'T%') AND Country='ARG'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Country,Name Country 3 NULL 104 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Country,Name Country 3 NULL 104 Using index condition; Using where EXPLAIN SELECT * FROM City WHERE Population < 200000 AND Name LIKE 'P%' AND (Population > 300000 OR Name LIKE 'T%') AND (Population < 100000 OR Name LIKE 'Pa%'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Name Name 35 NULL 135 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Name Name 35 NULL 135 Using index condition; Using where EXPLAIN SELECT * FROM City WHERE Population > 100000 AND Name LIKE 'Aba%' OR Country IN ('CAN', 'ARG') AND ID BETWEEN 120 AND 130 OR Country <= 'ALB' AND Name LIKE 'L%' OR ID BETWEEN 3807 AND 3810; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,PRIMARY,Country 35,4,3 NULL 30 Using sort_union(Name,PRIMARY,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Name,PRIMARY,Country 35,4,3 NULL 30 Using sort_union(Name,PRIMARY,Country); Using where EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 115000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 459 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 459 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 102000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 39 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 39 Using index condition EXPLAIN SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Country,Name Name,Country 35,3 NULL 172 Using sort_union(Name,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Country,Name Name,Country 35,3 NULL 172 Using sort_union(Name,Country); Using where EXPLAIN SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')) AND (Population > 101000 AND Population < 115000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Name,Country 35,3 NULL 172 Using sort_union(Name,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name Name,Country 35,3 NULL 172 Using sort_union(Name,Country); Using where EXPLAIN SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')) AND (Population > 101000 AND Population < 102000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Country,Name Population 4 NULL 39 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Country,Name Population 4 NULL 39 Using index condition; Using where SELECT * FROM City USE INDEX () WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')) AND (Population > 101000 AND Population < 115000); @@ -168,56 +168,56 @@ ID Name Country Population 637 Mit Ghamr EGY 101801 EXPLAIN SELECT * FROM City WHERE (Name < 'Ac'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 13 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 13 Using index condition EXPLAIN SELECT * FROM City WHERE (Name < 'Bb'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 207 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 207 Using index condition EXPLAIN SELECT * FROM City WHERE (Country > 'A' AND Country < 'B'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country Country 3 NULL 104 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country Country 3 NULL 104 Using index condition EXPLAIN SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'Pb'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 39 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 39 Using index condition EXPLAIN SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'S'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 221 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 221 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 110000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 328 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 328 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 103000 AND Population < 104000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 37 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 37 Using index condition EXPLAIN SELECT * FROM City WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Country,Name Name 35 NULL 52 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Country,Name Name 35 NULL 52 Using index condition; Using where EXPLAIN SELECT * FROM City WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR (Name BETWEEN 'P' AND 'S' AND (Population > 103000 AND Population < 104000)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Name,Population 35,4 NULL 50 Using sort_union(Name,Population); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name Name,Population 35,4 NULL 50 Using sort_union(Name,Population); Using where EXPLAIN SELECT * FROM City WHERE (Name < 'Bb' AND (Country > 'A' AND Country < 'B')) OR (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Country,Name 3,35 NULL 143 Using sort_union(Country,Name); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name Country,Name 3,35 NULL 143 Using sort_union(Country,Name); Using where EXPLAIN SELECT * FROM City WHERE (Name < 'Bb' AND (Country > 'A' AND Country < 'B')) OR (Name BETWEEN 'P' AND 'S' AND (Population > 103000 AND Population < 104000)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Country,Population 3,4 NULL 141 Using sort_union(Country,Population); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name Country,Population 3,4 NULL 141 Using sort_union(Country,Population); Using where SELECT * FROM City USE INDEX () WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000)); @@ -324,49 +324,49 @@ ID Name Country Population 2663 Río Bravo MEX 103901 EXPLAIN SELECT * FROM City WHERE (ID < 10) OR (ID BETWEEN 100 AND 110); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 20 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 20 Using index condition EXPLAIN SELECT * FROM City WHERE (ID < 200) OR (ID BETWEEN 100 AND 200); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 200 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 200 Using index condition EXPLAIN SELECT * FROM City WHERE (ID < 600) OR (ID BETWEEN 900 AND 1500); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL PRIMARY NULL NULL NULL 4079 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL PRIMARY NULL NULL NULL 4079 Using where EXPLAIN SELECT * FROM City WHERE Country > 'A' AND Country < 'ARG'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country Country 3 NULL 20 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country Country 3 NULL 20 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'H%' OR Name LIKE 'P%' ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 223 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 223 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'Ha%' OR Name LIKE 'Pa%' ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 72 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 72 Using index condition EXPLAIN SELECT * FROM City WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG'))) OR ((ID BETWEEN 100 AND 110) AND (Name LIKE 'P%' OR (Population > 103000 AND Population < 104000))); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 20 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY,Population,Country,Name PRIMARY 4 NULL 20 Using index condition; Using where EXPLAIN SELECT * FROM City WHERE ((ID < 800) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG'))) OR ((ID BETWEEN 900 AND 1500) AND (Name LIKE 'Pa%' OR (Population > 103000 AND Population < 105000))); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,Population 35,3,4 NULL 151 Using sort_union(Name,Country,Population); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Name,Country,Population 35,3,4 NULL 151 Using sort_union(Name,Country,Population); Using where EXPLAIN SELECT * FROM City WHERE ((ID < 200) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG'))) OR ((ID BETWEEN 100 AND 200) AND (Name LIKE 'Pa%' OR (Population > 103200 AND Population < 104000))); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,Population 35,3,4 NULL 124 Using sort_union(Name,Country,Population); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Name,Country,Population 35,3,4 NULL 124 Using sort_union(Name,Country,Population); Using where SELECT * FROM City USE INDEX () WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG'))) OR ((ID BETWEEN 100 AND 110) AND @@ -573,56 +573,56 @@ ID Name Country Population 191 Hamilton BMU 1200 EXPLAIN SELECT * FROM City WHERE Population > 101000 AND Population < 102000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 39 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 39 Using index condition EXPLAIN SELECT * FROM City WHERE Population > 101000 AND Population < 110000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 328 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 328 Using index condition EXPLAIN SELECT * FROM City WHERE Country < 'C'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country Country 3 NULL 435 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country Country 3 NULL 435 Using index condition EXPLAIN SELECT * FROM City WHERE Country < 'AGO'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country Country 3 NULL 5 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country Country 3 NULL 5 Using index condition EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'P' AND 'S'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 221 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 221 Using index condition EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'P' AND 'Pb'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 39 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 39 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3400 AND 3800; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 401 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 401 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'P%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 135 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 135 Using index condition EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 102000) AND (Country < 'C' OR Name BETWEEN 'P' AND 'S')) OR ((ID BETWEEN 3400 AND 3800) AND (Country < 'AGO' OR Name LIKE 'Pa%')); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name Country,Name,Population 3,35,4 NULL 83 Using sort_union(Country,Name,Population); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Country,Name,Population 3,35,4 NULL 83 Using sort_union(Country,Name,Population); Using where EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 110000) AND (Country < 'AGO' OR Name BETWEEN 'P' AND 'Pb')) OR ((ID BETWEEN 3790 AND 3800) AND (Country < 'C' OR Name LIKE 'P%')); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name Country,Name,PRIMARY 3,35,4 NULL 55 Using sort_union(Country,Name,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Country,Name,PRIMARY 3,35,4 NULL 55 Using sort_union(Country,Name,PRIMARY); Using where SELECT * FROM City USE INDEX () WHERE ((Population > 101000 AND Population < 102000) AND (Country < 'C' OR Name BETWEEN 'P' AND 'S')) OR @@ -676,36 +676,36 @@ ID Name Country Population CREATE INDEX CountryPopulation ON City(Country,Population); EXPLAIN SELECT * FROM City WHERE Name LIKE 'Pas%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 4 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'P%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 135 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 135 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 103000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 81 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 81 Using index condition EXPLAIN SELECT * FROM City WHERE Country='USA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref Country,CountryPopulation Country 3 const 267 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref Country,CountryPopulation Country 3 const 267 Using index condition EXPLAIN SELECT * FROM City WHERE Country='FIN'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref Country,CountryPopulation Country 3 const 7 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref Country,CountryPopulation Country 3 const 7 Using index condition EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%') AND Country='USA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name,CountryPopulation CountryPopulation,Name 7,35 NULL 14 Using sort_union(CountryPopulation,Name); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name,CountryPopulation CountryPopulation,Name 7,35 NULL 14 Using sort_union(CountryPopulation,Name); Using where EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'P%') AND Country='EST'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref Population,Country,Name,CountryPopulation Country 3 const 2 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref Population,Country,Name,CountryPopulation Country 3 const 2 Using index condition; Using where SELECT * FROM City WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%') AND Country='USA'; @@ -749,52 +749,52 @@ ID Name Country Population CREATE INDEX CountryName ON City(Country,Name); EXPLAIN SELECT * FROM City WHERE Country='USA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref Country,CountryPopulation,CountryName Country 3 const 267 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref Country,CountryPopulation,CountryName Country 3 const 267 Using index condition EXPLAIN SELECT * FROM City WHERE Country='FIN'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref Country,CountryPopulation,CountryName CountryName 3 const 5 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref Country,CountryPopulation,CountryName CountryName 3 const 5 Using index condition EXPLAIN SELECT * FROM City WHERE Country='BRA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref Country,CountryPopulation,CountryName CountryName 3 const 221 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref Country,CountryPopulation,CountryName CountryName 3 const 221 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 4025 AND 4035; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 4028 AND 4032; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 5 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 5 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3500 AND 3800; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 301 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 301 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 4000 AND 4300; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 80 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 80 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 250 and 260 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 102000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 39 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 39 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 103000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 81 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 81 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'Pa%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 41 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 41 Using index condition set @tmp_range_vs_index_merge=@@optimizer_switch; set optimizer_switch='extended_keys=off'; EXPLAIN @@ -802,22 +802,22 @@ SELECT * FROM City WHERE ((Population > 101000 AND Population < 102000) OR ID BETWEEN 3790 AND 3800) AND Country='USA' AND (Name LIKE 'Pa%' OR ID BETWEEN 4025 AND 4035); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,PRIMARY 7,4 NULL 14 Using sort_union(CountryPopulation,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,PRIMARY 7,4 NULL 14 Using sort_union(CountryPopulation,PRIMARY); Using where EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 103000) OR ID BETWEEN 3790 AND 3800) AND Country='USA' AND (Name LIKE 'Pa%' OR ID BETWEEN 4028 AND 4032); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName,PRIMARY 38,4 NULL 11 Using sort_union(CountryName,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName,PRIMARY 38,4 NULL 11 Using sort_union(CountryName,PRIMARY); Using where EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 110000) OR ID BETWEEN 3500 AND 3800) AND Country='FIN' AND (Name BETWEEN 'P' AND 'T' OR ID BETWEEN 4000 AND 4300); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName 3 const 5 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName 3 const 5 Using index condition; Using where SELECT * FROM City USE INDEX () WHERE ((Population > 101000 AND Population < 102000) OR ID BETWEEN 3790 AND 3800) AND Country='USA' @@ -865,8 +865,8 @@ SELECT * FROM City WHERE ((Population > 101000 and Population < 102000) OR ID BETWEEN 3790 AND 3800) AND Country='USA' OR (Name LIKE 'Pa%' OR ID BETWEEN 250 AND 260) AND Country='BRA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,PRIMARY,CountryName 7,4,38 NULL 35 Using sort_union(CountryPopulation,PRIMARY,CountryName); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,PRIMARY,CountryName 7,4,38 NULL 35 Using sort_union(CountryPopulation,PRIMARY,CountryName); Using where SELECT * FROM City USE INDEX () WHERE ((Population > 101000 and Population < 102000) OR ID BETWEEN 3790 AND 3800) AND Country='USA' @@ -948,15 +948,15 @@ SELECT * FROM City WHERE ((Population > 101000 AND Population < 11000) OR ID BETWEEN 3500 AND 3800) AND Country='USA' AND (Name LIKE 'P%' OR ID BETWEEN 4000 AND 4300); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range|filter PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName|PRIMARY 38|4 NULL 23 (7%) Using index condition; Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range|filter PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName|PRIMARY 38|4 NULL 23 (7%) Using index condition; Using where; Using rowid filter EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 11000) OR ID BETWEEN 3500 AND 3800) AND Country='USA' AND (Name LIKE 'Pho%' OR ID BETWEEN 4000 AND 4300); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY,Population,Country,Name,CountryPopulation,CountryName Name 35 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY,Population,Country,Name,CountryPopulation,CountryName Name 35 NULL 1 Using where SELECT * FROM City USE INDEX () WHERE ((Population > 101000 AND Population < 11000) OR ID BETWEEN 3500 AND 3800) AND Country='USA' @@ -990,8 +990,8 @@ EXPLAIN SELECT * FROM City WHERE Country='USA' AND Population BETWEEN 101000 AND 102000 OR Country='USA' AND Name LIKE 'Pa%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Country,CountryPopulation,CountryName CountryPopulation,CountryName 7,38 NULL 10 Using sort_union(CountryPopulation,CountryName); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Country,CountryPopulation,CountryName CountryPopulation,CountryName 7,38 NULL 10 Using sort_union(CountryPopulation,CountryName); Using where SELECT * FROM City USE INDEX() WHERE Country='USA' AND Population BETWEEN 101000 AND 102000 OR Country='USA' AND Name LIKE 'Pa%'; @@ -1020,8 +1020,8 @@ EXPLAIN SELECT * FROM City WHERE Country='USA' AND (Population BETWEEN 101000 AND 102000 OR Name LIKE 'Pa%'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Country,CountryPopulation,CountryName CountryPopulation,CountryName 7,38 NULL 10 Using sort_union(CountryPopulation,CountryName); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Country,CountryPopulation,CountryName CountryPopulation,CountryName 7,38 NULL 10 Using sort_union(CountryPopulation,CountryName); Using where SELECT * FROM City WHERE Country='USA' AND (Population BETWEEN 101000 AND 102000 OR Name LIKE 'Pa%'); @@ -1076,8 +1076,8 @@ EXPLAIN SELECT Name, Country, Population FROM City WHERE (Name='Caracas' AND Country='VEN') OR (Name='Samara' AND Country='RUS') OR (Name='Seattle' AND Country='USA'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Country,CountryPopulation,CountryName,CityName CountryName,CityName 38,35 NULL 28 Using sort_union(CountryName,CityName); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Country,CountryPopulation,CountryName,CityName CountryName,CityName 38,35 NULL 28 Using sort_union(CountryName,CityName); Using where SELECT Name, Country, Population FROM City WHERE (Name='Manila' AND Country='PHL') OR (Name='Addis Abeba' AND Country='ETH') OR @@ -1163,8 +1163,8 @@ EXPLAIN SELECT Name, Country, Population FROM City WHERE (Name='Caracas' AND Country='VEN') OR (Name='Samara' AND Country='RUS') OR (Name='Seattle' AND Country='USA'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 28 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 28 Using index condition SELECT Name, Country, Population FROM City WHERE (Name='Manila' AND Country='PHL') OR (Name='Addis Abeba' AND Country='ETH') OR @@ -1235,8 +1235,8 @@ EXPLAIN SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) AND (Population >= 100000 AND Population < 120000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Country,Name,Population Name,Country 35,3 NULL # Using sort_union(Name,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Country,Name,Population Name,Country 35,3 NULL # Using sort_union(Name,Country); Using where FLUSH STATUS; SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) @@ -1317,8 +1317,8 @@ SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) AND (Population >= 100000 AND Population < 120000) ORDER BY Population LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country,Name,Population Population 4 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # Using where FLUSH STATUS; SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) @@ -1348,8 +1348,8 @@ SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) AND (Population >= 100000 AND Population < 120000) ORDER BY Population LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country,Name,Population Population 4 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # Using where FLUSH STATUS; SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) @@ -1379,8 +1379,8 @@ SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) AND (Population >= 100000 AND Population < 120000) ORDER BY Population LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country,Name,Population Population 4 NULL # Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # Using index condition; Using where FLUSH STATUS; SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) @@ -1477,8 +1477,8 @@ id account_id first_name middle_name last_name home_address_1 home_city home_sta explain select * from t1 where (home_state = 'ia' or work_state='ia') and account_id = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge account_id,user_home_state_indx,user_work_state_indx user_home_state_indx,user_work_state_indx 3,3 NULL 6 Using union(user_home_state_indx,user_work_state_indx); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge account_id,user_home_state_indx,user_work_state_indx user_home_state_indx,user_work_state_indx 3,3 NULL 6 Using union(user_home_state_indx,user_work_state_indx); Using where drop table t1; CREATE TABLE t1 ( c1 int(11) NOT NULL auto_increment, @@ -1526,18 +1526,18 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1 where (c2=1 and c3=1) or (c4=2 and c5=1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge k1,k2 k1,k2 12,12 NULL 2 Using sort_union(k1,k2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 12,12 NULL 2 Using sort_union(k1,k2); Using where explain select * from t1 where (c2=1 and c3=1 and cp=1) or (c4=2 and c5=1 and cp=1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge k1,k2 k1,k2 14,14 NULL 2 Using sort_union(k1,k2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 14,14 NULL 2 Using sort_union(k1,k2); Using where explain select * from t1 where ((c2=1 and c3=1) or (c4=2 and c5=1)) and cp=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge k1,k2 k1,k2 14,14 NULL 2 Using sort_union(k1,k2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 14,14 NULL 2 Using sort_union(k1,k2); Using where select * from t1 where (c2=1 and c3=1 and cp=1) or (c4=2 and c5=1 and cp=1); c1 c2 c3 c4 c5 cp ce cdata @@ -1585,12 +1585,12 @@ count(*) 3840 explain select distinct c1 from t1 where (c2='e' OR c3='q'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge k1,k2 k1,k2 21,21 NULL 2 Using union(k1,k2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 21,21 NULL 2 Using union(k1,k2); Using where explain select distinct c1 from t1 where (c4!= 0) AND (c2='e' OR c3='q'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge k1,k2,k3 k1,k2 21,21 NULL 2 Using union(k1,k2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge k1,k2,k3 k1,k2 21,21 NULL 2 Using union(k1,k2); Using where drop table t1; create table t1 ( id int unsigned auto_increment primary key, @@ -1619,12 +1619,12 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date explain select * from t1 where (c1=' 100000' or c2=' 2000000'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge c1,c2 c1,c2 13,16 NULL 2 Using union(c1,c2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge c1,c2 c1,c2 13,16 NULL 2 Using union(c1,c2); Using where explain select * from t1 where (c1=' 100000' or c2=' 2000000') and c3='2'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge c1,c2,c3 c1,c2 13,16 NULL 2 Using union(c1,c2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge c1,c2,c3 c1,c2 13,16 NULL 2 Using union(c1,c2); Using where select * from t1 where (c1=' 100000' or c2=' 2000000'); id c1 c2 c3 select * from t1 where (c1=' 100000' or c2=' 2000000') and c3='2'; @@ -1653,8 +1653,8 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE c = 'i' OR b IN ( 'Arkansas' , 'd' , 'pdib' , 'can' ) OR (pk BETWEEN 120 AND 79 + 255 OR a IN ( 4 , 179 , 1 ) ) AND a > 8 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,idx1,idx2,idx3 idx3,idx2,PRIMARY,idx1 67,13,4,3 NULL 9 Using sort_union(idx3,idx2,PRIMARY,idx1); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge PRIMARY,idx1,idx2,idx3 idx3,idx2,PRIMARY,idx1 67,13,4,3 NULL 9 Using sort_union(idx3,idx2,PRIMARY,idx1); Using where DROP TABLE t1; CREATE TABLE t1 ( f1 int, f2 int, f3 int, f4 int, f5 int, @@ -1686,8 +1686,8 @@ EXPLAIN SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY,f3,f4 NULL NULL NULL 306 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY,f3,f4 NULL NULL NULL 306 Using where SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); @@ -1698,8 +1698,8 @@ EXPLAIN SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 Using union(f3,PRIMARY,f3); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 Using union(f3,PRIMARY,f3); Using where SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); @@ -1719,8 +1719,8 @@ EXPLAIN SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY,f3,f4 NULL NULL NULL 320 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY,f3,f4 NULL NULL NULL 320 Using where SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); @@ -1731,8 +1731,8 @@ EXPLAIN SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 Using union(f3,PRIMARY,f3); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 Using union(f3,PRIMARY,f3); Using where SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); @@ -1765,8 +1765,8 @@ SET SESSION optimizer_switch='index_merge_sort_union=off'; EXPLAIN SELECT * FROM t1 WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where SELECT * FROM t1 WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; a b c d @@ -1779,8 +1779,8 @@ SET SESSION optimizer_switch='index_merge_sort_union=on'; EXPLAIN SELECT * FROM t1 WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where SELECT * FROM t1 WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; a b c d @@ -1797,8 +1797,8 @@ EXPLAIN SELECT * FROM t1 WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND (t1.c=0 OR t1.a=500); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,idx PRIMARY 4 NULL 1 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,idx PRIMARY 4 NULL 1 Using index condition; Using where SELECT * FROM t1 WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND (t1.c=0 OR t1.a=500); @@ -1809,8 +1809,8 @@ INSERT INTO t1 VALUES (167,9999), (168,10000); EXPLAIN SELECT * FROM t1 WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR (a<2 or a>2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY,idx NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY,idx NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR (a<2 or a>2); a b @@ -1846,8 +1846,8 @@ EXPLAIN SELECT * FROM t1 FORCE KEY (state,capital) WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND (id<9 or id>9) OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range state,capital state 71 NULL 8 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range state,capital state 71 NULL 8 Using index condition; Using where SELECT * FROM t1 FORCE KEY (state,capital) WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND (id<9 or id>9) OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas'; @@ -1937,7 +1937,7 @@ Country='FRA' AND Name IN ('Paris', 'Marcel') OR Country='POL' AND Name IN ('Warszawa', 'Wroclaw') OR Country='NOR' AND Name IN ('Oslo', 'Bergen') OR Country='ITA' AND Name IN ('Napoli', 'Venezia'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range CountryName,Name CountryName 38 NULL 20 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range CountryName,Name CountryName 38 NULL 20 Using index condition DROP DATABASE world; set session optimizer_switch='index_merge_sort_intersection=default'; diff --git a/mysql-test/main/range_vs_index_merge.test b/mysql-test/main/range_vs_index_merge.test index 670762bcb2f..8a2c990c94a 100644 --- a/mysql-test/main/range_vs_index_merge.test +++ b/mysql-test/main/range_vs_index_merge.test @@ -37,7 +37,7 @@ set session optimizer_switch='index_merge_sort_intersection=off'; # The following 4 queries are added for code coverage #the exptected # of rows differ on 32-bit and 64-bit platforms for innodb ---replace_column 9 4079 +--replace_column 10 4079 EXPLAIN SELECT * FROM City WHERE (Population >= 100000 OR Name LIKE 'P%' OR Population < 100000); @@ -693,7 +693,7 @@ CREATE INDEX Name ON City(Name); CREATE INDEX Population ON City(Population); ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) @@ -705,7 +705,7 @@ SELECT * FROM City SHOW STATUS LIKE 'Handler_read_%'; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) @@ -721,7 +721,7 @@ SHOW STATUS LIKE 'Handler_read_%'; set @tmp_mdev585=@@optimizer_use_condition_selectivity; set optimizer_use_condition_selectivity=1; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) @@ -739,7 +739,7 @@ set optimizer_use_condition_selectivity=@tmp_mdev585; set optimizer_switch='index_merge=off'; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) diff --git a/mysql-test/main/range_vs_index_merge_innodb.result b/mysql-test/main/range_vs_index_merge_innodb.result index 79a670aedb2..d5312131345 100644 --- a/mysql-test/main/range_vs_index_merge_innodb.result +++ b/mysql-test/main/range_vs_index_merge_innodb.result @@ -46,56 +46,56 @@ set session optimizer_switch='index_merge_sort_intersection=off'; EXPLAIN SELECT * FROM City WHERE (Population >= 100000 OR Name LIKE 'P%' OR Population < 100000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ALL Population,Name NULL NULL NULL 4079 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ALL Population,Name NULL NULL NULL 4079 Using where EXPLAIN SELECT * FROM City WHERE (Population >= 100000 OR Name LIKE 'P%') AND Country='CAN' OR (Population < 100000 OR Name Like 'T%') AND Country='ARG'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Country,Name Country 3 NULL 106 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Country,Name Country 3 NULL 106 Using index condition; Using where EXPLAIN SELECT * FROM City WHERE Population < 200000 AND Name LIKE 'P%' AND (Population > 300000 OR Name LIKE 'T%') AND (Population < 100000 OR Name LIKE 'Pa%'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Name Name 35 NULL 236 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Name Name 35 NULL 236 Using index condition; Using where EXPLAIN SELECT * FROM City WHERE Population > 100000 AND Name LIKE 'Aba%' OR Country IN ('CAN', 'ARG') AND ID BETWEEN 120 AND 130 OR Country <= 'ALB' AND Name LIKE 'L%' OR ID BETWEEN 3807 AND 3810; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 35,3,4 NULL 32 Using sort_union(Name,Country,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 35,3,4 NULL 32 Using sort_union(Name,Country,PRIMARY); Using where EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 115000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 459 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 459 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 102000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 39 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 39 Using index condition EXPLAIN SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Country,Name Name,Country 35,3 NULL 215 Using sort_union(Name,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Country,Name Name,Country 35,3 NULL 215 Using sort_union(Name,Country); Using where EXPLAIN SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')) AND (Population > 101000 AND Population < 115000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Name,Country 35,3 NULL 215 Using sort_union(Name,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name Name,Country 35,3 NULL 215 Using sort_union(Name,Country); Using where EXPLAIN SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')) AND (Population > 101000 AND Population < 102000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Country,Name Population 4 NULL 39 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Country,Name Population 4 NULL 39 Using index condition; Using where SELECT * FROM City USE INDEX () WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')) AND (Population > 101000 AND Population < 115000); @@ -174,56 +174,56 @@ ID Name Country Population 637 Mit Ghamr EGY 101801 EXPLAIN SELECT * FROM City WHERE (Name < 'Ac'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 23 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 23 Using index condition EXPLAIN SELECT * FROM City WHERE (Name < 'Bb'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 374 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 374 Using index condition EXPLAIN SELECT * FROM City WHERE (Country > 'A' AND Country < 'B'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country Country 3 NULL 107 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country Country 3 NULL 107 Using index condition EXPLAIN SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'Pb'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 71 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 71 Using index condition EXPLAIN SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'S'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 385 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 385 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 110000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 328 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 328 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 103000 AND Population < 104000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 37 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 37 Using index condition EXPLAIN SELECT * FROM City WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Country,Name Name 35 NULL 94 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population,Country,Name Name 35 NULL 94 Using index condition; Using where EXPLAIN SELECT * FROM City WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR (Name BETWEEN 'P' AND 'S' AND (Population > 103000 AND Population < 104000)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Name,Population 35,4 NULL 60 Using sort_union(Name,Population); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name Name,Population 35,4 NULL 60 Using sort_union(Name,Population); Using where EXPLAIN SELECT * FROM City WHERE (Name < 'Bb' AND (Country > 'A' AND Country < 'B')) OR (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Country,Name 3,35 NULL 178 Using sort_union(Country,Name); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name Country,Name 3,35 NULL 178 Using sort_union(Country,Name); Using where EXPLAIN SELECT * FROM City WHERE (Name < 'Bb' AND (Country > 'A' AND Country < 'B')) OR (Name BETWEEN 'P' AND 'S' AND (Population > 103000 AND Population < 104000)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Country,Population 3,4 NULL 144 Using sort_union(Country,Population); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name Country,Population 3,4 NULL 144 Using sort_union(Country,Population); Using where SELECT * FROM City USE INDEX () WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000)); @@ -330,49 +330,49 @@ ID Name Country Population 2663 Río Bravo MEX 103901 EXPLAIN SELECT * FROM City WHERE (ID < 10) OR (ID BETWEEN 100 AND 110); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 20 Using where EXPLAIN SELECT * FROM City WHERE (ID < 200) OR (ID BETWEEN 100 AND 200); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 200 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 200 Using where EXPLAIN SELECT * FROM City WHERE (ID < 600) OR (ID BETWEEN 900 AND 1500); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 1200 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 1200 Using where EXPLAIN SELECT * FROM City WHERE Country > 'A' AND Country < 'ARG'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country Country 3 NULL 20 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country Country 3 NULL 20 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'H%' OR Name LIKE 'P%' ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 395 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 395 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'Ha%' OR Name LIKE 'Pa%' ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 133 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 133 Using index condition EXPLAIN SELECT * FROM City WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG'))) OR ((ID BETWEEN 100 AND 110) AND (Name LIKE 'P%' OR (Population > 103000 AND Population < 104000))); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY,Population,Country,Name PRIMARY 4 NULL 20 Using where EXPLAIN SELECT * FROM City WHERE ((ID < 800) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG'))) OR ((ID BETWEEN 900 AND 1500) AND (Name LIKE 'Pa%' OR (Population > 103000 AND Population < 105000))); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 39,3,4 NULL 683 Using sort_union(Name,Country,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 39,3,4 NULL 683 Using sort_union(Name,Country,PRIMARY); Using where EXPLAIN SELECT * FROM City WHERE ((ID < 200) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG'))) OR ((ID BETWEEN 100 AND 200) AND (Name LIKE 'Pa%' OR (Population > 103200 AND Population < 104000))); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY,Population,Country,Name PRIMARY 4 NULL 200 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY,Population,Country,Name PRIMARY 4 NULL 200 Using where SELECT * FROM City USE INDEX () WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG'))) OR ((ID BETWEEN 100 AND 110) AND @@ -579,56 +579,56 @@ ID Name Country Population 191 Hamilton BMU 1200 EXPLAIN SELECT * FROM City WHERE Population > 101000 AND Population < 102000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 39 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 39 Using index condition EXPLAIN SELECT * FROM City WHERE Population > 101000 AND Population < 110000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 328 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 328 Using index condition EXPLAIN SELECT * FROM City WHERE Country < 'C'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country Country 3 NULL 446 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country Country 3 NULL 446 Using index condition EXPLAIN SELECT * FROM City WHERE Country < 'AGO'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country Country 3 NULL 5 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country Country 3 NULL 5 Using index condition EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'P' AND 'S'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 385 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 385 Using index condition EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'P' AND 'Pb'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 71 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 71 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3400 AND 3800; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 401 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 401 Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'P%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 236 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 236 Using index condition EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 102000) AND (Country < 'C' OR Name BETWEEN 'P' AND 'S')) OR ((ID BETWEEN 3400 AND 3800) AND (Country < 'AGO' OR Name LIKE 'Pa%')); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name Population,PRIMARY 4,4 NULL 440 Using sort_union(Population,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Population,PRIMARY 4,4 NULL 440 Using sort_union(Population,PRIMARY); Using where EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 110000) AND (Country < 'AGO' OR Name BETWEEN 'P' AND 'Pb')) OR ((ID BETWEEN 3790 AND 3800) AND (Country < 'C' OR Name LIKE 'P%')); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name Country,Name,PRIMARY 3,35,4 NULL 87 Using sort_union(Country,Name,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Country,Name,PRIMARY 3,35,4 NULL 87 Using sort_union(Country,Name,PRIMARY); Using where SELECT * FROM City USE INDEX () WHERE ((Population > 101000 AND Population < 102000) AND (Country < 'C' OR Name BETWEEN 'P' AND 'S')) OR @@ -682,36 +682,36 @@ ID Name Country Population CREATE INDEX CountryPopulation ON City(Country,Population); EXPLAIN SELECT * FROM City WHERE Name LIKE 'Pas%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 8 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 8 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'P%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 236 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 236 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 103000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 81 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 81 Using index condition EXPLAIN SELECT * FROM City WHERE Country='USA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref Country,CountryPopulation Country 3 const 274 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref Country,CountryPopulation Country 3 const 274 Using index condition EXPLAIN SELECT * FROM City WHERE Country='FIN'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref Country,CountryPopulation Country 3 const 7 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref Country,CountryPopulation Country 3 const 7 Using index condition EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%') AND Country='USA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name,CountryPopulation CountryPopulation,Name 7,35 NULL 18 Using sort_union(CountryPopulation,Name); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Population,Country,Name,CountryPopulation CountryPopulation,Name 7,35 NULL 18 Using sort_union(CountryPopulation,Name); Using where EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'P%') AND Country='EST'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref Population,Country,Name,CountryPopulation Country 3 const 2 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref Population,Country,Name,CountryPopulation Country 3 const 2 Using index condition; Using where SELECT * FROM City WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%') AND Country='USA'; @@ -755,52 +755,52 @@ ID Name Country Population CREATE INDEX CountryName ON City(Country,Name); EXPLAIN SELECT * FROM City WHERE Country='USA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref Country,CountryPopulation,CountryName Country 3 const 274 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref Country,CountryPopulation,CountryName Country 3 const 274 Using index condition EXPLAIN SELECT * FROM City WHERE Country='FIN'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref Country,CountryPopulation,CountryName Country 3 const 7 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref Country,CountryPopulation,CountryName Country 3 const 7 Using index condition EXPLAIN SELECT * FROM City WHERE Country='BRA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref Country,CountryPopulation,CountryName Country 3 const 250 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref Country,CountryPopulation,CountryName Country 3 const 250 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 4025 AND 4035; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 4028 AND 4032; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 5 Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3500 AND 3800; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 301 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 301 Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 4000 AND 4300; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 80 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 80 Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 250 and 260 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY PRIMARY 4 NULL 11 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 Using where EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 102000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 39 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 39 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 103000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population Population 4 NULL 81 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Population Population 4 NULL 81 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'Pa%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Name Name 35 NULL 71 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Name Name 35 NULL 71 Using index condition set @tmp_range_vs_index_merge=@@optimizer_switch; set optimizer_switch='extended_keys=off'; EXPLAIN @@ -808,22 +808,22 @@ SELECT * FROM City WHERE ((Population > 101000 AND Population < 102000) OR ID BETWEEN 3790 AND 3800) AND Country='USA' AND (Name LIKE 'Pa%' OR ID BETWEEN 4025 AND 4035); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,PRIMARY 7,4 NULL 14 Using sort_union(CountryPopulation,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,PRIMARY 7,4 NULL 14 Using sort_union(CountryPopulation,PRIMARY); Using where EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 103000) OR ID BETWEEN 3790 AND 3800) AND Country='USA' AND (Name LIKE 'Pa%' OR ID BETWEEN 4028 AND 4032); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName,PRIMARY 38,4 NULL 10 Using sort_union(CountryName,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName,PRIMARY 38,4 NULL 10 Using sort_union(CountryName,PRIMARY); Using where EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 110000) OR ID BETWEEN 3500 AND 3800) AND Country='FIN' AND (Name BETWEEN 'P' AND 'T' OR ID BETWEEN 4000 AND 4300); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref PRIMARY,Population,Country,Name,CountryPopulation,CountryName Country 3 const 7 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref PRIMARY,Population,Country,Name,CountryPopulation,CountryName Country 3 const 7 Using index condition; Using where SELECT * FROM City USE INDEX () WHERE ((Population > 101000 AND Population < 102000) OR ID BETWEEN 3790 AND 3800) AND Country='USA' @@ -871,8 +871,8 @@ SELECT * FROM City WHERE ((Population > 101000 and Population < 102000) OR ID BETWEEN 3790 AND 3800) AND Country='USA' OR (Name LIKE 'Pa%' OR ID BETWEEN 250 AND 260) AND Country='BRA'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,CountryName,PRIMARY 7,38,4 NULL 36 Using sort_union(CountryPopulation,CountryName,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,CountryName,PRIMARY 7,38,4 NULL 36 Using sort_union(CountryPopulation,CountryName,PRIMARY); Using where SELECT * FROM City USE INDEX () WHERE ((Population > 101000 and Population < 102000) OR ID BETWEEN 3790 AND 3800) AND Country='USA' @@ -954,15 +954,15 @@ SELECT * FROM City WHERE ((Population > 101000 AND Population < 11000) OR ID BETWEEN 3500 AND 3800) AND Country='USA' AND (Name LIKE 'P%' OR ID BETWEEN 4000 AND 4300); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName 38 NULL 18 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName 38 NULL 18 Using index condition EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 11000) OR ID BETWEEN 3500 AND 3800) AND Country='USA' AND (Name LIKE 'Pho%' OR ID BETWEEN 4000 AND 4300); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY,Population,Country,Name,CountryPopulation,CountryName Name 35 NULL 1 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range PRIMARY,Population,Country,Name,CountryPopulation,CountryName Name 35 NULL 1 Using index condition; Using where SELECT * FROM City USE INDEX () WHERE ((Population > 101000 AND Population < 11000) OR ID BETWEEN 3500 AND 3800) AND Country='USA' @@ -996,8 +996,8 @@ EXPLAIN SELECT * FROM City WHERE Country='USA' AND Population BETWEEN 101000 AND 102000 OR Country='USA' AND Name LIKE 'Pa%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Country,CountryPopulation,CountryName CountryPopulation,CountryName 7,38 NULL 8 Using sort_union(CountryPopulation,CountryName); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Country,CountryPopulation,CountryName CountryPopulation,CountryName 7,38 NULL 8 Using sort_union(CountryPopulation,CountryName); Using where SELECT * FROM City USE INDEX() WHERE Country='USA' AND Population BETWEEN 101000 AND 102000 OR Country='USA' AND Name LIKE 'Pa%'; @@ -1026,8 +1026,8 @@ EXPLAIN SELECT * FROM City WHERE Country='USA' AND (Population BETWEEN 101000 AND 102000 OR Name LIKE 'Pa%'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Country,CountryPopulation,CountryName CountryPopulation,CountryName 7,38 NULL 8 Using sort_union(CountryPopulation,CountryName); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Country,CountryPopulation,CountryName CountryPopulation,CountryName 7,38 NULL 8 Using sort_union(CountryPopulation,CountryName); Using where SELECT * FROM City WHERE Country='USA' AND (Population BETWEEN 101000 AND 102000 OR Name LIKE 'Pa%'); @@ -1082,8 +1082,8 @@ EXPLAIN SELECT Name, Country, Population FROM City WHERE (Name='Caracas' AND Country='VEN') OR (Name='Samara' AND Country='RUS') OR (Name='Seattle' AND Country='USA'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 27 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 27 Using index condition SELECT Name, Country, Population FROM City WHERE (Name='Manila' AND Country='PHL') OR (Name='Addis Abeba' AND Country='ETH') OR @@ -1169,8 +1169,8 @@ EXPLAIN SELECT Name, Country, Population FROM City WHERE (Name='Caracas' AND Country='VEN') OR (Name='Samara' AND Country='RUS') OR (Name='Seattle' AND Country='USA'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 27 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 27 Using index condition SELECT Name, Country, Population FROM City WHERE (Name='Manila' AND Country='PHL') OR (Name='Addis Abeba' AND Country='ETH') OR @@ -1241,8 +1241,8 @@ EXPLAIN SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) AND (Population >= 100000 AND Population < 120000); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Country,Name,Population Name,Country 35,3 NULL # Using sort_union(Name,Country); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL index_merge Country,Name,Population Name,Country 35,3 NULL # Using sort_union(Name,Country); Using where FLUSH STATUS; SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) @@ -1323,8 +1323,8 @@ SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) AND (Population >= 100000 AND Population < 120000) ORDER BY Population LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country,Name,Population Population 4 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # Using where FLUSH STATUS; SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) @@ -1354,8 +1354,8 @@ SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) AND (Population >= 100000 AND Population < 120000) ORDER BY Population LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country,Name,Population Population 4 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # Using where FLUSH STATUS; SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) @@ -1385,8 +1385,8 @@ SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) AND (Population >= 100000 AND Population < 120000) ORDER BY Population LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country,Name,Population Population 4 NULL # Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # Using index condition; Using where FLUSH STATUS; SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) @@ -1483,8 +1483,8 @@ id account_id first_name middle_name last_name home_address_1 home_city home_sta explain select * from t1 where (home_state = 'ia' or work_state='ia') and account_id = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge account_id,user_home_state_indx,user_work_state_indx user_home_state_indx,user_work_state_indx 3,3 NULL 12 Using union(user_home_state_indx,user_work_state_indx); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge account_id,user_home_state_indx,user_work_state_indx user_home_state_indx,user_work_state_indx 3,3 NULL 12 Using union(user_home_state_indx,user_work_state_indx); Using where drop table t1; CREATE TABLE t1 ( c1 int(11) NOT NULL auto_increment, @@ -1532,18 +1532,18 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1 where (c2=1 and c3=1) or (c4=2 and c5=1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge k1,k2 k1,k2 12,12 NULL 2 Using sort_union(k1,k2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 12,12 NULL 2 Using sort_union(k1,k2); Using where explain select * from t1 where (c2=1 and c3=1 and cp=1) or (c4=2 and c5=1 and cp=1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge k1,k2 k1,k2 14,14 NULL 2 Using sort_union(k1,k2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 14,14 NULL 2 Using sort_union(k1,k2); Using where explain select * from t1 where ((c2=1 and c3=1) or (c4=2 and c5=1)) and cp=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge k1,k2 k1,k2 14,14 NULL 2 Using sort_union(k1,k2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 14,14 NULL 2 Using sort_union(k1,k2); Using where select * from t1 where (c2=1 and c3=1 and cp=1) or (c4=2 and c5=1 and cp=1); c1 c2 c3 c4 c5 cp ce cdata @@ -1591,12 +1591,12 @@ count(*) 3840 explain select distinct c1 from t1 where (c2='e' OR c3='q'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge k1,k2 k1,k2 21,21 NULL 2 Using union(k1,k2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 21,21 NULL 2 Using union(k1,k2); Using where explain select distinct c1 from t1 where (c4!= 0) AND (c2='e' OR c3='q'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge k1,k2,k3 k1,k2 21,21 NULL 2 Using union(k1,k2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge k1,k2,k3 k1,k2 21,21 NULL 2 Using union(k1,k2); Using where drop table t1; create table t1 ( id int unsigned auto_increment primary key, @@ -1625,12 +1625,12 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1 where (c1=' 100000' or c2=' 2000000'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge c1,c2 c1,c2 13,16 NULL 2 Using union(c1,c2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge c1,c2 c1,c2 13,16 NULL 2 Using union(c1,c2); Using where explain select * from t1 where (c1=' 100000' or c2=' 2000000') and c3='2'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge c1,c2,c3 c1,c2 13,16 NULL 2 Using union(c1,c2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge c1,c2,c3 c1,c2 13,16 NULL 2 Using union(c1,c2); Using where select * from t1 where (c1=' 100000' or c2=' 2000000'); id c1 c2 c3 select * from t1 where (c1=' 100000' or c2=' 2000000') and c3='2'; @@ -1659,8 +1659,8 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE c = 'i' OR b IN ( 'Arkansas' , 'd' , 'pdib' , 'can' ) OR (pk BETWEEN 120 AND 79 + 255 OR a IN ( 4 , 179 , 1 ) ) AND a > 8 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,idx1,idx2,idx3 idx3,idx2,idx1,PRIMARY 67,13,3,4 NULL 9 Using sort_union(idx3,idx2,idx1,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge PRIMARY,idx1,idx2,idx3 idx3,idx2,idx1,PRIMARY 67,13,3,4 NULL 9 Using sort_union(idx3,idx2,idx1,PRIMARY); Using where DROP TABLE t1; CREATE TABLE t1 ( f1 int, f2 int, f3 int, f4 int, f5 int, @@ -1692,8 +1692,8 @@ EXPLAIN SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY,f3,f4 NULL NULL NULL 306 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY,f3,f4 NULL NULL NULL 306 Using where SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); @@ -1704,8 +1704,8 @@ EXPLAIN SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,f3,f4 PRIMARY,f3 4,5 NULL 5 Using union(PRIMARY,f3); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge PRIMARY,f3,f4 PRIMARY,f3 4,5 NULL 5 Using union(PRIMARY,f3); Using where SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); @@ -1725,8 +1725,8 @@ EXPLAIN SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY,f3,f4 NULL NULL NULL 320 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY,f3,f4 NULL NULL NULL 320 Using where SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); @@ -1737,8 +1737,8 @@ EXPLAIN SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,f3,f4 PRIMARY,f3 4,5 NULL 5 Using union(PRIMARY,f3); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge PRIMARY,f3,f4 PRIMARY,f3 4,5 NULL 5 Using union(PRIMARY,f3); Using where SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 < 7 ); @@ -1771,8 +1771,8 @@ SET SESSION optimizer_switch='index_merge_sort_union=off'; EXPLAIN SELECT * FROM t1 WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where SELECT * FROM t1 WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; a b c d @@ -1785,8 +1785,8 @@ SET SESSION optimizer_switch='index_merge_sort_union=on'; EXPLAIN SELECT * FROM t1 WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where SELECT * FROM t1 WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7; a b c d @@ -1803,8 +1803,8 @@ EXPLAIN SELECT * FROM t1 WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND (t1.c=0 OR t1.a=500); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,idx idx 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY,idx idx 5 NULL 2 Using where; Using index SELECT * FROM t1 WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND (t1.c=0 OR t1.a=500); @@ -1815,8 +1815,8 @@ INSERT INTO t1 VALUES (167,9999), (168,10000); EXPLAIN SELECT * FROM t1 WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR (a<2 or a>2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY,idx idx 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY,idx idx 5 NULL 2 Using where; Using index SELECT * FROM t1 WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR (a<2 or a>2); a b @@ -1852,8 +1852,8 @@ EXPLAIN SELECT * FROM t1 FORCE KEY (state,capital) WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND (id<9 or id>9) OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range state,capital state 71 NULL 8 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range state,capital state 71 NULL 8 Using index condition; Using where SELECT * FROM t1 FORCE KEY (state,capital) WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND (id<9 or id>9) OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas'; @@ -1943,8 +1943,8 @@ Country='FRA' AND Name IN ('Paris', 'Marcel') OR Country='POL' AND Name IN ('Warszawa', 'Wroclaw') OR Country='NOR' AND Name IN ('Oslo', 'Bergen') OR Country='ITA' AND Name IN ('Napoli', 'Venezia'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range CountryName,Name Name 35 NULL 20 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL range CountryName,Name Name 35 NULL 20 Using index condition; Using where DROP DATABASE world; set session optimizer_switch='index_merge_sort_intersection=default'; set global innodb_stats_persistent= @innodb_stats_persistent_save; diff --git a/mysql-test/main/row.result b/mysql-test/main/row.result index 12ab4208c11..6252684c0a0 100644 --- a/mysql-test/main/row.result +++ b/mysql-test/main/row.result @@ -68,8 +68,8 @@ select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL))); row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL))) NULL explain extended select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL))); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select (1,2,(3,4)) in ((3,2,(3,4)),(1,2,(3,NULL))) AS `row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))` select row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(4,5))); @@ -327,11 +327,11 @@ row(NULL,1)=(2,0) CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)); INSERT INTO t1 VALUES (1,1), (2,1), (3,1), (1,2), (3,2), (3,3); EXPLAIN SELECT * FROM t1 WHERE a=3 AND b=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 8 const,const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 8 const,const 1 Using index EXPLAIN SELECT * FROM t1 WHERE (a,b)=(3,2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 8 const,const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 8 const,const 1 Using index SELECT * FROM t1 WHERE a=3 and b=2; a b 3 2 @@ -343,13 +343,13 @@ INSERT INTO t2 VALUES (1,1,2), (3,1,3), (1,2,2), (4,4,2), (1,1,1), (3,1,1), (1,2,1); EXPLAIN SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t1.b=t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 Using index -1 SIMPLE t2 ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 6 Using index +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 Using index EXPLAIN SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 Using index -1 SIMPLE t2 ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 6 Using index +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 Using index SELECT * FROM t1,t2 WHERE t1.a=t2.a and t1.b=t2.b; a b a b c 1 1 1 1 1 @@ -367,13 +367,13 @@ a b a b c 3 1 3 1 1 3 1 3 1 3 EXPLAIN SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t1.b=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 Using where; Using index -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 6 Using where; Using index +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a 1 Using index EXPLAIN SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 Using where; Using index -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 6 Using where; Using index +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a 1 Using index SELECT * FROM t1,t2 WHERE t1.a=1 and t1.b=t2.b; a b a b c 1 1 1 1 1 @@ -391,9 +391,9 @@ a b a b c 3 2 3 1 1 3 2 3 1 3 EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b+1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 6 100.00 Using index +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` + 1 SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b+1); @@ -403,9 +403,9 @@ a b a b c 3 2 3 1 1 3 2 3 1 3 EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t1.a-1,t1.b)=(t2.a-1,t2.b+1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL PRIMARY 8 NULL 6 100.00 Using index -1 SIMPLE t2 index NULL PRIMARY 12 NULL 7 100.00 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 6 100.00 Using index +1 SIMPLE t2 NULL index NULL PRIMARY 12 NULL 7 100.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` - 1 = `test`.`t2`.`a` - 1 and `test`.`t1`.`b` = `test`.`t2`.`b` + 1 SELECT * FROM t1,t2 WHERE (t1.a-1,t1.b)=(t2.a-1,t2.b+1); @@ -415,23 +415,23 @@ a b a b c 3 2 3 1 1 3 2 3 1 3 EXPLAIN SELECT * FROM t2 WHERE a=3 AND b=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref PRIMARY PRIMARY 8 const,const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 8 const,const 1 Using index EXPLAIN SELECT * FROM t2 WHERE (a,b)=(3,2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref PRIMARY PRIMARY 8 const,const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 8 const,const 1 Using index SELECT * FROM t2 WHERE a=3 and b=2; a b c SELECT * FROM t2 WHERE (a,b)=(3,2); a b c EXPLAIN SELECT * FROM t1,t2 WHERE t2.a=t1.a AND t2.b=2 AND t2.c=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 Using index -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 6 Using index +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 Using index EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 6 100.00 Using index +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 100.00 Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t2`.`b` = 2 and `test`.`t2`.`c` = 1 SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1)); @@ -439,9 +439,9 @@ a b a b c 1 1 1 2 1 1 2 1 2 1 EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 6 100.00 Using index +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 100.00 Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t2`.`b` = 2 and `test`.`t2`.`c` = 1 SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1); @@ -526,13 +526,13 @@ End of 5.1 tests CREATE TABLE t1 (a INT, b INT); INSERT INTO t1 VALUES (10,10),(20,20); EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND b=10 AND a>=10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 10 and `test`.`t1`.`b` = 10 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,b)=(10,10) AND a>=10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 10 and `test`.`t1`.`b` = 10 DROP TABLE t1; diff --git a/mysql-test/main/rowid_filter.result b/mysql-test/main/rowid_filter.result index 10662f0edfa..bf572cf909d 100644 --- a/mysql-test/main/rowid_filter.result +++ b/mysql-test/main/rowid_filter.result @@ -68,8 +68,8 @@ correct_r_filtered_when_using_l_shipdate set statement optimizer_switch='rowid_filter=on' for EXPLAIN SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range|filter i_l_shipdate,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 509 (12%) Using index condition; Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range|filter i_l_shipdate,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 509 (12%) Using index condition; Using where; Using rowid filter set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; @@ -106,8 +106,8 @@ EXPLAIN set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range|filter i_l_shipdate,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 509 (12%) 60.00 (11%) 11.69 100.00 Using index condition; Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range|filter i_l_shipdate,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 509 (12%) 60.00 (11%) 11.69 100.00 Using index condition; Using where; Using rowid filter set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; @@ -219,8 +219,8 @@ l_orderkey l_linenumber l_shipdate l_quantity set statement optimizer_switch='rowid_filter=off' for EXPLAIN SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range i_l_shipdate,i_l_quantity i_l_shipdate 4 NULL 509 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range i_l_shipdate,i_l_quantity i_l_shipdate 4 NULL 509 Using index condition; Using where set statement optimizer_switch='rowid_filter=off' for EXPLAIN FORMAT=JSON SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; @@ -249,8 +249,8 @@ EXPLAIN set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range i_l_shipdate,i_l_quantity i_l_shipdate 4 NULL 509 510.00 11.69 11.76 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range i_l_shipdate,i_l_quantity i_l_shipdate 4 NULL 509 510.00 11.69 11.76 Using index condition; Using where set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; @@ -351,9 +351,9 @@ set statement optimizer_switch='rowid_filter=on' for EXPLAIN SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 Using index condition -1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (5%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 Using index condition +1 SIMPLE orders NULL eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (5%) Using where; Using rowid filter set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND @@ -410,9 +410,9 @@ set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 98.00 100.00 100.00 Using index condition -1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (5%) 0.11 (10%) 4.60 100.00 Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 98.00 100.00 100.00 Using index condition +1 SIMPLE orders NULL eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (5%) 0.11 (10%) 4.60 100.00 Using where; Using rowid filter set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND @@ -501,9 +501,9 @@ set statement optimizer_switch='rowid_filter=off' for EXPLAIN SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 Using index condition -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 Using index condition +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where set statement optimizer_switch='rowid_filter=off' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND @@ -552,9 +552,9 @@ set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 98.00 100.00 100.00 Using index condition -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 4.60 11.22 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 98.00 100.00 100.00 Using index condition +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 4.60 11.22 Using where set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND @@ -632,9 +632,9 @@ FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45 AND o_totalprice between 180000 and 230000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 509 (12%) Using index condition; Using where; Using rowid filter -1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (9%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 509 (12%) Using index condition; Using where; Using rowid filter +1 SIMPLE orders NULL eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (9%) Using where; Using rowid filter set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -703,9 +703,9 @@ FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45 AND o_totalprice between 180000 and 230000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 509 (12%) 60.00 (11%) 11.69 100.00 Using index condition; Using where; Using rowid filter -1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (9%) 0.27 (25%) 9.27 100.00 Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 509 (12%) 60.00 (11%) 11.69 100.00 Using index condition; Using where; Using rowid filter +1 SIMPLE orders NULL eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (9%) 0.27 (25%) 9.27 100.00 Using where; Using rowid filter set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -816,9 +816,9 @@ FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45 AND o_totalprice between 180000 and 230000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate 4 NULL 509 Using index condition; Using where -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate 4 NULL 509 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where set statement optimizer_switch='rowid_filter=off' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -871,9 +871,9 @@ FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45 AND o_totalprice between 180000 and 230000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate 4 NULL 509 510.00 11.69 11.76 Using index condition; Using where -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 9.27 26.67 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate 4 NULL 509 510.00 11.69 11.76 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 9.27 26.67 Using where set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -959,9 +959,9 @@ set statement optimizer_switch='rowid_filter=on' for EXPLAIN SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 69 Using index condition -1 SIMPLE lineitem ref|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey|i_l_shipdate 4|4 dbt3_s001.orders.o_orderkey 4 (8%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 69 Using index condition +1 SIMPLE lineitem NULL ref|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey|i_l_shipdate 4|4 dbt3_s001.orders.o_orderkey 4 (8%) Using where; Using rowid filter set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -1018,9 +1018,9 @@ set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 69 71.00 100.00 100.00 Using index condition -1 SIMPLE lineitem ref|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey|i_l_shipdate 4|4 dbt3_s001.orders.o_orderkey 4 (8%) 0.52 (7%) 8.48 100.00 Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 69 71.00 100.00 100.00 Using index condition +1 SIMPLE lineitem NULL ref|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey|i_l_shipdate 4|4 dbt3_s001.orders.o_orderkey 4 (8%) 0.52 (7%) 8.48 100.00 Using where; Using rowid filter set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -1135,9 +1135,9 @@ set statement optimizer_switch='rowid_filter=off' for EXPLAIN SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 69 Using index condition -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 69 Using index condition +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where set statement optimizer_switch='rowid_filter=off' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -1186,9 +1186,9 @@ set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 69 71.00 100.00 100.00 Using index condition -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.70 8.48 7.77 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 69 71.00 100.00 100.00 Using index condition +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.70 8.48 7.77 Using where set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -1300,9 +1300,9 @@ WHERE o_orderkey=l_orderkey AND l_shipdate BETWEEN '1996-10-01' AND '1996-10-10' AND l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND o_totalprice BETWEEN 200000 AND 250000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 Using index condition; Using where -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT l_shipdate, l_receiptdate, o_totalprice FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1357,9 +1357,9 @@ WHERE o_orderkey=l_orderkey AND l_shipdate BETWEEN '1996-10-01' AND '1996-10-10' AND l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND o_totalprice BETWEEN 200000 AND 250000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 18.00 0.57 38.89 Using index condition; Using where -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 7.47 14.29 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 18.00 0.57 38.89 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 7.47 14.29 Using where set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT l_shipdate, l_receiptdate, o_totalprice FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1434,9 +1434,9 @@ WHERE o_orderkey=l_orderkey AND l_shipdate BETWEEN '1996-10-01' AND '1996-10-10' AND l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND o_totalprice BETWEEN 200000 AND 250000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 Using index condition; Using where -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where set statement optimizer_switch='rowid_filter=off' for EXPLAIN FORMAT=JSON SELECT l_shipdate, l_receiptdate, o_totalprice FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1491,9 +1491,9 @@ WHERE o_orderkey=l_orderkey AND l_shipdate BETWEEN '1996-10-01' AND '1996-10-10' AND l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND o_totalprice BETWEEN 200000 AND 250000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 18.00 0.57 38.89 Using index condition; Using where -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 7.47 14.29 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 18.00 0.57 38.89 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 7.47 14.29 Using where set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT l_shipdate, l_receiptdate, o_totalprice FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1575,9 +1575,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1631,9 +1631,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 41.00 3.20 2.44 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.00 3.05 66.67 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 41.00 3.20 2.44 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.00 3.05 66.67 Using where set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1710,9 +1710,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where set statement optimizer_switch='rowid_filter=off' for EXPLAIN FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1766,9 +1766,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 41.00 3.20 2.44 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.00 3.05 66.67 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 41.00 3.20 2.44 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.00 3.05 66.67 Using where set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1848,9 +1848,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM v1, lineitem WHERE o_orderkey=l_orderkey AND @@ -1909,9 +1909,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 41.00 # 2.44 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.00 # 66.67 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 41.00 # 2.44 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.00 # 66.67 Using where set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM v1, lineitem WHERE o_orderkey=l_orderkey AND @@ -1993,9 +1993,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where set statement optimizer_switch='rowid_filter=off' for EXPLAIN FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM v1, lineitem WHERE o_orderkey=l_orderkey AND @@ -2054,9 +2054,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 41.00 # 2.44 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.00 # 66.67 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 41.00 # 2.44 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 6.00 # 66.67 Using where set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM v1, lineitem WHERE o_orderkey=l_orderkey AND @@ -2166,8 +2166,8 @@ left join t2 join t1 as t1_a on t2.i1 = t1_a.pk on t1.c2 = t2.c1 where t1_a.pk is null and t1_a.i1 != 3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 1 AS `1` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t1_a` where 0 drop table t1,t2; @@ -2203,9 +2203,9 @@ SELECT * FROM t1 HAVING (7, 9) IN (SELECT t2.i1, t2.i2 FROM t2 WHERE t2.i1 = 3); pk EXPLAIN EXTENDED SELECT * FROM t1 HAVING (7, 9) IN (SELECT t2.i1, t2.i2 FROM t2 WHERE t2.i1 = 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` having 0 DROP TABLE t1,t2; @@ -2241,10 +2241,10 @@ pk1 a1 b1 pk2 a2 b2 65 2 a 109 65 NULL EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 101 100.00 Using where -1 PRIMARY t1 eq_ref|filter PRIMARY,b1 PRIMARY|b1 4|4 test.t2.a2 1 (87%) 87.00 Using where; Using rowid filter -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 101 100.00 Using where +1 PRIMARY t1 NULL eq_ref|filter PRIMARY,b1 PRIMARY|b1 4|4 test.t2.a2 1 (87%) 87.00 Using where; Using rowid filter +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using index condition Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`pk2` AS `pk2`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`pk1` = `test`.`t2`.`a2` and `test`.`t1`.`b1` <= (/* select#2 */ select max(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`pk2` <= 1) and `test`.`t2`.`a2` <> `test`.`t2`.`pk2` EXPLAIN FORMAT=JSON SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) @@ -2345,8 +2345,8 @@ test.t1 analyze status Table is already up to date explain select * from t1 where el_index like '10%' and (el_index_60 like '10%' or el_index_60 like '20%'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range el_index,el_index_60 el_index 62 NULL 645 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range el_index,el_index_60 el_index 62 NULL 645 Using where drop table t10, t11, t1; # # MDEV-22160: SIGSEGV in st_join_table::save_explain_data on SELECT @@ -2357,8 +2357,8 @@ CREATE TABLE t1 (a INT, b INT, INDEX(a), INDEX(b)); INSERT INTO t1 VALUES (0,0),(1,0),(-1,1), (-2,1), (-2,3), (-3,4), (-2,4); explain SELECT * FROM t1 WHERE a > 0 AND b=0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter a,b b|a 5|5 const 2 (14%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref|filter a,b b|a 5|5 const 2 (14%) Using where; Using rowid filter SELECT * FROM t1 WHERE a > 0 AND b=0; a b 1 0 diff --git a/mysql-test/main/rowid_filter.test b/mysql-test/main/rowid_filter.test index 163b71b6153..d6fd8f1778e 100644 --- a/mysql-test/main/rowid_filter.test +++ b/mysql-test/main/rowid_filter.test @@ -218,7 +218,7 @@ WHERE o_orderkey=l_orderkey AND eval $with_filter EXPLAIN $q7; --replace_regex /"filtered": [0-9e\.\-+]*,/"filtered": "REPLACED",/ eval $with_filter EXPLAIN FORMAT=JSON $q7; ---replace_column 11 # +--replace_column 12 # eval $with_filter ANALYZE $q7; --replace_regex /("(r_(total|table|other)_time_ms|r_buffer_size|r_filling_time_ms|filtered)": )[^, \n]*/\1"REPLACED"/ eval $with_filter ANALYZE FORMAT=JSON $q7; @@ -228,7 +228,7 @@ eval $with_filter $q7; eval $without_filter EXPLAIN $q7; --replace_regex /"filtered": [0-9e\.\-+]*,/"filtered": "REPLACED",/ eval $without_filter EXPLAIN FORMAT=JSON $q7; ---replace_column 11 # +--replace_column 12 # eval $without_filter ANALYZE $q7; --replace_regex /("(r_(total|table|other)_time_ms|r_buffer_size|r_filling_time_ms|filtered)": )[^, \n]*/\1"REPLACED"/ eval $without_filter ANALYZE FORMAT=JSON $q7; diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result index 90a119aa8c8..9595a3d440f 100644 --- a/mysql-test/main/rowid_filter_innodb.result +++ b/mysql-test/main/rowid_filter_innodb.result @@ -71,8 +71,8 @@ correct_r_filtered_when_using_l_shipdate set statement optimizer_switch='rowid_filter=on' for EXPLAIN SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range|filter i_l_shipdate,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 510 (10%) Using index condition; Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range|filter i_l_shipdate,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 510 (10%) Using index condition; Using where; Using rowid filter set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; @@ -109,8 +109,8 @@ EXPLAIN set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range|filter i_l_shipdate,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 510 (10%) 60.00 (11%) 10.07 100.00 Using index condition; Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range|filter i_l_shipdate,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 510 (10%) 60.00 (11%) 10.07 100.00 Using index condition; Using where; Using rowid filter set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; @@ -222,8 +222,8 @@ l_orderkey l_linenumber l_shipdate l_quantity set statement optimizer_switch='rowid_filter=off' for EXPLAIN SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range i_l_shipdate,i_l_quantity i_l_shipdate 4 NULL 510 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range i_l_shipdate,i_l_quantity i_l_shipdate 4 NULL 510 Using index condition; Using where set statement optimizer_switch='rowid_filter=off' for EXPLAIN FORMAT=JSON SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; @@ -252,8 +252,8 @@ EXPLAIN set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range i_l_shipdate,i_l_quantity i_l_shipdate 4 NULL 510 510.00 10.07 11.76 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range i_l_shipdate,i_l_quantity i_l_shipdate 4 NULL 510 510.00 10.07 11.76 Using index condition; Using where set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT l_orderkey, l_linenumber, l_shipdate, l_quantity FROM lineitem WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45; @@ -354,9 +354,9 @@ set statement optimizer_switch='rowid_filter=on' for EXPLAIN SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 Using where; Using index -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 Using where; Using index +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND @@ -406,9 +406,9 @@ set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 98.00 100.00 100.00 Using where; Using index -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 4.73 11.22 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 98.00 100.00 100.00 Using where; Using index +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 4.73 11.22 Using where set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND @@ -486,9 +486,9 @@ set statement optimizer_switch='rowid_filter=off' for EXPLAIN SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 Using where; Using index -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 Using where; Using index +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where set statement optimizer_switch='rowid_filter=off' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND @@ -538,9 +538,9 @@ set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 98.00 100.00 100.00 Using where; Using index -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 4.73 11.22 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 98.00 100.00 100.00 Using where; Using index +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 4.73 11.22 Using where set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND @@ -619,9 +619,9 @@ FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45 AND o_totalprice between 180000 and 230000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 510 (10%) Using index condition; Using where; Using rowid filter -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 510 (10%) Using index condition; Using where; Using rowid filter +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -682,9 +682,9 @@ FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45 AND o_totalprice between 180000 and 230000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 510 (10%) 60.00 (11%) 10.07 100.00 Using index condition; Using where; Using rowid filter -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 9.60 26.67 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 510 (10%) 60.00 (11%) 10.07 100.00 Using index condition; Using where; Using rowid filter +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 9.60 26.67 Using where set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -783,9 +783,9 @@ FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45 AND o_totalprice between 180000 and 230000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 144 Using where; Using index -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 144 Using where; Using index +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where set statement optimizer_switch='rowid_filter=off' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -838,9 +838,9 @@ FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 45 AND o_totalprice between 180000 and 230000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 144 144.00 100.00 100.00 Using where; Using index -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.62 0.86 1.68 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 144 144.00 100.00 100.00 Using where; Using index +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.62 0.86 1.68 Using where set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -926,9 +926,9 @@ set statement optimizer_switch='rowid_filter=on' for EXPLAIN SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 71 Using where; Using index -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 71 Using where; Using index +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -978,9 +978,9 @@ set statement optimizer_switch='rowid_filter=on' for ANALYZE SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 71 71.00 100.00 100.00 Using where; Using index -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.70 8.49 7.77 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 71 71.00 100.00 100.00 Using where; Using index +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.70 8.49 7.77 Using where set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -1084,9 +1084,9 @@ set statement optimizer_switch='rowid_filter=off' for EXPLAIN SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 71 Using where; Using index -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 71 Using where; Using index +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where set statement optimizer_switch='rowid_filter=off' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -1136,9 +1136,9 @@ set statement optimizer_switch='rowid_filter=off' for ANALYZE SELECT o_orderkey, FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND o_totalprice between 200000 and 230000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 71 71.00 100.00 100.00 Using where; Using index -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.70 8.49 7.77 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 71 71.00 100.00 100.00 Using where; Using index +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.70 8.49 7.77 Using where set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice FROM orders JOIN lineitem ON o_orderkey=l_orderkey WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND @@ -1251,9 +1251,9 @@ WHERE o_orderkey=l_orderkey AND l_shipdate BETWEEN '1996-10-01' AND '1996-10-10' AND l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND o_totalprice BETWEEN 200000 AND 250000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 Using index condition; Using where -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT l_shipdate, l_receiptdate, o_totalprice FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1308,9 +1308,9 @@ WHERE o_orderkey=l_orderkey AND l_shipdate BETWEEN '1996-10-01' AND '1996-10-10' AND l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND o_totalprice BETWEEN 200000 AND 250000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 18.00 0.57 38.89 Using index condition; Using where -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 5.67 14.29 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 18.00 0.57 38.89 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 5.67 14.29 Using where set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT l_shipdate, l_receiptdate, o_totalprice FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1385,9 +1385,9 @@ WHERE o_orderkey=l_orderkey AND l_shipdate BETWEEN '1996-10-01' AND '1996-10-10' AND l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND o_totalprice BETWEEN 200000 AND 250000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 Using index condition; Using where -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where set statement optimizer_switch='rowid_filter=off' for EXPLAIN FORMAT=JSON SELECT l_shipdate, l_receiptdate, o_totalprice FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1442,9 +1442,9 @@ WHERE o_orderkey=l_orderkey AND l_shipdate BETWEEN '1996-10-01' AND '1996-10-10' AND l_receiptdate BETWEEN '1996-10-05' AND '1996-10-10' AND o_totalprice BETWEEN 200000 AND 250000; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 18.00 0.57 38.89 Using index condition; Using where -1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 5.67 14.29 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_receiptdate 4 NULL 18 18.00 0.57 38.89 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 5.67 14.29 Using where set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT l_shipdate, l_receiptdate, o_totalprice FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1526,9 +1526,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1582,9 +1582,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 41.00 3.33 2.44 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.00 3.05 66.67 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 41.00 3.33 2.44 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.00 3.05 66.67 Using where set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1661,9 +1661,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where set statement optimizer_switch='rowid_filter=off' for EXPLAIN FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1717,9 +1717,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE orders range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 41.00 3.33 2.44 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.00 3.05 66.67 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 41.00 3.33 2.44 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.00 3.05 66.67 Using where set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM orders, lineitem WHERE o_orderkey=l_orderkey AND @@ -1799,9 +1799,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM v1, lineitem WHERE o_orderkey=l_orderkey AND @@ -1860,9 +1860,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 41.00 # 2.44 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.00 # 66.67 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 41.00 # 2.44 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.00 # 66.67 Using where set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM v1, lineitem WHERE o_orderkey=l_orderkey AND @@ -1944,9 +1944,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where set statement optimizer_switch='rowid_filter=off' for EXPLAIN FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM v1, lineitem WHERE o_orderkey=l_orderkey AND @@ -2005,9 +2005,9 @@ WHERE o_orderkey=l_orderkey AND o_totaldiscount BETWEEN 18000 AND 20000 AND o_totalprice BETWEEN 200000 AND 220000 AND l_shipdate BETWEEN '1996-10-01' AND '1996-12-01'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 41.00 # 2.44 Using index condition; Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.00 # 66.67 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 41.00 # 2.44 Using index condition; Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 6.00 # 66.67 Using where set statement optimizer_switch='rowid_filter=off' for ANALYZE FORMAT=JSON SELECT o_totaldiscount, o_totalprice, l_shipdate FROM v1, lineitem WHERE o_orderkey=l_orderkey AND @@ -2117,8 +2117,8 @@ left join t2 join t1 as t1_a on t2.i1 = t1_a.pk on t1.c2 = t2.c1 where t1_a.pk is null and t1_a.i1 != 3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 1 AS `1` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t1_a` where 0 drop table t1,t2; @@ -2154,9 +2154,9 @@ SELECT * FROM t1 HAVING (7, 9) IN (SELECT t2.i1, t2.i2 FROM t2 WHERE t2.i1 = 3); pk EXPLAIN EXTENDED SELECT * FROM t1 HAVING (7, 9) IN (SELECT t2.i1, t2.i2 FROM t2 WHERE t2.i1 = 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` having 0 DROP TABLE t1,t2; @@ -2192,10 +2192,10 @@ pk1 a1 b1 pk2 a2 b2 65 2 a 109 65 NULL EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 101 100.00 Using where -1 PRIMARY t1 eq_ref|filter PRIMARY,b1 PRIMARY|b1 4|4 test.t2.a2 1 (87%) 87.00 Using where; Using rowid filter -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 101 100.00 Using where +1 PRIMARY t1 NULL eq_ref|filter PRIMARY,b1 PRIMARY|b1 4|4 test.t2.a2 1 (87%) 87.00 Using where; Using rowid filter +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using index condition Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`pk2` AS `pk2`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`pk1` = `test`.`t2`.`a2` and `test`.`t1`.`b1` <= (/* select#2 */ select max(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`pk2` <= 1) and `test`.`t2`.`a2` <> `test`.`t2`.`pk2` EXPLAIN FORMAT=JSON SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) @@ -2296,8 +2296,8 @@ test.t1 analyze status OK explain select * from t1 where el_index like '10%' and (el_index_60 like '10%' or el_index_60 like '20%'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range el_index,el_index_60 el_index 62 NULL 1000 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range el_index,el_index_60 el_index 62 NULL 1000 Using where drop table t10, t11, t1; # # MDEV-22160: SIGSEGV in st_join_table::save_explain_data on SELECT @@ -2308,8 +2308,8 @@ CREATE TABLE t1 (a INT, b INT, INDEX(a), INDEX(b)); INSERT INTO t1 VALUES (0,0),(1,0),(-1,1), (-2,1), (-2,3), (-3,4), (-2,4); explain SELECT * FROM t1 WHERE a > 0 AND b=0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter a,b b|a 5|5 const 2 (14%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref|filter a,b b|a 5|5 const 2 (14%) Using where; Using rowid filter SELECT * FROM t1 WHERE a > 0 AND b=0; a b 1 0 @@ -2351,10 +2351,10 @@ where (f1 is null and f2 is null) and (f2 between 'a' and 'z' or f1 in ('a'))) union ( select * from t1 where (f1 is null and f2 is null) and (f2 between 'a' and 'z' or f1 in ('a'))); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref|filter f1,f2 f1|f1 13|13 const 1 (2%) Using index condition; Using where; Using rowid filter -2 UNION t1 ref|filter f1,f2 f1|f1 13|13 const 1 (2%) Using index condition; Using where; Using rowid filter -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref|filter f1,f2 f1|f1 13|13 const 1 (2%) Using index condition; Using where; Using rowid filter +2 UNION t1 NULL ref|filter f1,f2 f1|f1 13|13 const 1 (2%) Using index condition; Using where; Using rowid filter +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL explain format=json ( select * from t1 where (f1 is null and f2 is null) and (f2 between 'a' and 'z' or f1 in ('a'))) union @@ -2447,9 +2447,9 @@ select * from t1 join t2 on t1.id = t2.x where t2.y = 2 and t1.id = 1; id y x 1 2 1 explain extended select * from t1 join t2 on t1.id = t2.x where t2.y = 2 and t1.id = 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00 Using index -1 SIMPLE t2 ref x,y y 5 const 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t2 NULL ref x,y y 5 const 2 100.00 Using where Warnings: Note 1003 select 1 AS `id`,`test`.`t2`.`y` AS `y`,`test`.`t2`.`x` AS `x` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`y` = 2 and `test`.`t2`.`x` = 1 drop table t1, t2; @@ -2469,8 +2469,8 @@ select count(*) from t1 where a in (22,83,11) and b=2; count(*) 6 explain extended select count(*) from t1 where a in (22,83,11) and b=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range b,a a 5 NULL 33 5.90 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b,a a 5 NULL 33 5.90 Using index condition; Using where Warnings: Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` in (22,83,11) select * from t1 where a in (22,83,11) and b=2; @@ -2486,8 +2486,8 @@ select count(*) from t1 where a in (22,83,11) and b=2; count(*) 6 explain extended select count(*) from t1 where a in (22,83,11) and b=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref|filter b,a b|a 5|5 const 59 (3%) 3.30 Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter b,a b|a 5|5 const 59 (3%) 3.30 Using where; Using rowid filter Warnings: Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` in (22,83,11) select * from t1 where a in (22,83,11) and b=2; @@ -2526,8 +2526,8 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN EXTENDED SELECT a FROM t1 WHERE c < 'k' AND b > 't' ORDER BY a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range|filter b,c b|c 13|1027 NULL 5 (42%) 41.67 Using index condition; Using where; Using filesort; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range|filter b,c b|c 13|1027 NULL 5 (42%) 41.67 Using index condition; Using where; Using filesort; Using rowid filter Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`c` < 'k' and `test`.`t1`.`b` > 't' order by `test`.`t1`.`a` SELECT a FROM t1 WHERE c < 'k' AND b > 't' ORDER BY a; @@ -2570,11 +2570,11 @@ WHERE t3.id IN ( SELECT bt1.id FROM t2, t1 AS bt1 WHERE bt1.id = t2.pk AND t2.ch2 <= 'g' ) OR t1.id2 = t1.id); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 1 100.00 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 10 100.00 Using where -3 MATERIALIZED t2 range PRIMARY,col_date_key,ch2,id2 ch2 4 NULL 2 100.00 Using where; Using index -3 MATERIALIZED bt1 ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +3 MATERIALIZED t2 NULL range PRIMARY,col_date_key,ch2,id2 ch2 4 NULL 2 100.00 Using where; Using index +3 MATERIALIZED bt1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t3.id' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t3` where <in_optimizer>(1,<expr_cache><`test`.`t3`.`id`>(exists(/* select#2 */ select 1 from `test`.`t1` where <expr_cache><`test`.`t3`.`id`>(<in_optimizer>(`test`.`t3`.`id`,`test`.`t3`.`id` in ( <materialize> (/* select#3 */ select `test`.`bt1`.`id` from `test`.`t2` join `test`.`t1` `bt1` where `test`.`bt1`.`id` = `test`.`t2`.`pk` and `test`.`t2`.`ch2` <= 'g' ), <primary_index_lookup>(`test`.`t3`.`id` in <temporary table> on distinct_key where `test`.`t3`.`id` = `<subquery3>`.`id`)))) or `test`.`t1`.`id2` = `test`.`t1`.`id` limit 1))) @@ -2593,11 +2593,11 @@ WHERE bt1.ch = t2.ch2 AND bt1.id = t2.pk AND t2.ch2 <= 'g' ) OR t1.id2 = t1.id); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 1 100.00 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 10 100.00 Using where -3 MATERIALIZED t2 range PRIMARY,col_date_key,ch2,id2 ch2 4 NULL 2 100.00 Using where; Using index -3 MATERIALIZED bt1 ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +3 MATERIALIZED t2 NULL range PRIMARY,col_date_key,ch2,id2 ch2 4 NULL 2 100.00 Using where; Using index +3 MATERIALIZED bt1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t3.id' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t3` where <in_optimizer>(1,<expr_cache><`test`.`t3`.`id`>(exists(/* select#2 */ select 1 from `test`.`t1` where <expr_cache><`test`.`t3`.`id`>(<in_optimizer>(`test`.`t3`.`id`,`test`.`t3`.`id` in ( <materialize> (/* select#3 */ select `test`.`bt1`.`id` from `test`.`t2` join `test`.`t1` `bt1` where `test`.`bt1`.`ch` = `test`.`t2`.`ch2` and `test`.`bt1`.`id` = `test`.`t2`.`pk` and `test`.`t2`.`ch2` <= 'g' ), <primary_index_lookup>(`test`.`t3`.`id` in <temporary table> on distinct_key where `test`.`t3`.`id` = `<subquery3>`.`id`)))) or `test`.`t1`.`id2` = `test`.`t1`.`id` limit 1))) @@ -2636,8 +2636,8 @@ test.t1 analyze Warning Engine-independent statistics are not collected for colu test.t1 analyze status OK explain extended select count(0) from t1 where id=15066 and (match s against ('+"fttest"' in boolean mode)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 fulltext id,s s 0 1 1.64 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL fulltext id,s s 0 1 1.64 Using where Warnings: Note 1003 select count(0) AS `count(0)` from `test`.`t1` where `test`.`t1`.`id` = 15066 and (match `test`.`t1`.`s` against ('+"fttest"' in boolean mode)) select count(0) from t1 @@ -2754,8 +2754,8 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1 = 1 AND domain = 'www.mailhost.i-dev.fr' AND timestamp >= DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -1 MONTH) ORDER BY timestamp DESC; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref|filter ixEventWhoisDomainDomain,ixEventWhoisDomainTimestamp ixEventWhoisDomainDomain|ixEventWhoisDomainTimestamp 767|4 const 2 (14%) 14.29 Using index condition; Using where; Using filesort; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter ixEventWhoisDomainDomain,ixEventWhoisDomainTimestamp ixEventWhoisDomainDomain|ixEventWhoisDomainTimestamp 767|4 const 2 (14%) 14.29 Using index condition; Using where; Using filesort; Using rowid filter Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`domain` AS `domain`,`test`.`t1`.`registrant_name` AS `registrant_name`,`test`.`t1`.`registrant_organization` AS `registrant_organization`,`test`.`t1`.`registrant_street1` AS `registrant_street1`,`test`.`t1`.`registrant_street2` AS `registrant_street2`,`test`.`t1`.`registrant_street3` AS `registrant_street3`,`test`.`t1`.`registrant_street4` AS `registrant_street4`,`test`.`t1`.`registrant_street5` AS `registrant_street5`,`test`.`t1`.`registrant_city` AS `registrant_city`,`test`.`t1`.`registrant_postal_code` AS `registrant_postal_code`,`test`.`t1`.`registrant_country` AS `registrant_country`,`test`.`t1`.`registrant_email` AS `registrant_email`,`test`.`t1`.`registrant_telephone` AS `registrant_telephone`,`test`.`t1`.`administrative_name` AS `administrative_name`,`test`.`t1`.`administrative_organization` AS `administrative_organization`,`test`.`t1`.`administrative_street1` AS `administrative_street1`,`test`.`t1`.`administrative_stree t2` AS `administrative_street2`,`test`.`t1`.`administrative_street3` AS `administrative_street3`,`test`.`t1`.`administrative_street4` AS `administrative_street4`,`test`.`t1`.`administrative_street5` AS `administrative_street5`,`test`.`t1`.`administrative_city` AS `administrative_city`,`test`.`t1`.`administrative_postal_code` AS `administrative_postal_code`,`test`.`t1`.`administrative_country` AS `administrative_country`,`test`.`t1`.`administrative_email` AS `administrative_email`,`test`.`t1`.`administrative_telephone` AS `administrative_telephone`,`test`.`t1`.`technical_name` AS `technical_name`,`test`.`t1`.`technical_organization` AS `technical_organization`,`test`.`t1`.`technical_street1` AS `technical_street1`,`test`.`t1`.`technical_street2` AS `technical_street2`,`test`.`t1`.`technical_street3` AS `technical_street3`,`test`.`t1`.`technical_street4` AS `technical_street4`,`test`.`t1`.`technical_street5` AS `technical_street5`,`test`.`t1`.`technical_city` AS `technical_city`,`test `.`t1`.`technical_postal_code` AS `technical_postal_code`,`test`.`t1`.`technical_country` AS `technical_country`,`test`.`t1`.`technical_email` AS `technical_email`,`test`.`t1`.`technical_telephone` AS `technical_telephone`,`test`.`t1`.`json` AS `json`,`test`.`t1`.`timestamp` AS `timestamp` from `test`.`t1` where `test`.`t1`.`domain` = 'www.mailhost.i-dev.fr' and `test`.`t1`.`timestamp` >= <cache>(current_timestamp() + interval -1 month) order by `test`.`t1`.`timestamp` desc SET optimizer_switch=@save_optimizer_switch; @@ -2793,24 +2793,24 @@ test.t1 analyze status OK EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range|filter a,b b|a 5|5 NULL 192 (21%) 21.31 Using index condition; Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range|filter a,b b|a 5|5 NULL 192 (21%) 21.31 Using index condition; Using where; Using rowid filter Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a` between 9 and 10 or `test`.`t1`.`a` is null) and (`test`.`t1`.`b` between 9 and 10 or `test`.`t1`.`b` = 9) EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9) ORDER BY pk LIMIT 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index a,b PRIMARY 4 NULL 75 54.55 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index a,b PRIMARY 4 NULL 75 54.55 Using where Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a` between 9 and 10 or `test`.`t1`.`a` is null) and (`test`.`t1`.`b` between 9 and 10 or `test`.`t1`.`b` = 9) order by `test`.`t1`.`pk` limit 1 ANALYZE SELECT * FROM t1 WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9) ORDER BY pk LIMIT 1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 index a,b PRIMARY 4 NULL 3008 3008.00 1.36 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL index a,b PRIMARY 4 NULL 3008 3008.00 1.36 0.00 Using where DROP TABLE t1; SET global innodb_stats_persistent= @stats.save; # @@ -2940,10 +2940,10 @@ t.tp = 121 and a.atp = 1 and fi.fh in (6311439873746261694,-397087483897438286, 8518228073041491534,-5420422472375069774); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index -1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where -1 SIMPLE fi ref filt_aceid,filt_fh filt_aceid 8 test.a.id 1 17.14 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index +1 SIMPLE a NULL ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where +1 SIMPLE fi NULL ref filt_aceid,filt_fh filt_aceid 8 test.a.id 1 17.14 Using where Warnings: Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774) set statement optimizer_switch='rowid_filter=off' for select t.id, fi.* @@ -2967,10 +2967,10 @@ t.tp = 121 and a.atp = 1 and fi.fh in (6311439873746261694,-397087483897438286, 8518228073041491534,-5420422472375069774); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index -1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where -1 SIMPLE fi ref|filter filt_aceid,filt_fh filt_aceid|filt_fh 8|8 test.a.id 1 (17%) 17.14 Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index +1 SIMPLE a NULL ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where +1 SIMPLE fi NULL ref|filter filt_aceid,filt_fh filt_aceid|filt_fh 8|8 test.a.id 1 (17%) 17.14 Using where; Using rowid filter Warnings: Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774) set statement optimizer_switch='rowid_filter=on' for select t.id, fi.* @@ -2996,10 +2996,10 @@ t.tp = 121 and a.atp = 1 and fi.fh in (6311439873746261694,-397087483897438286, 8518228073041491534,-5420422472375069774); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index -1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where; Using join buffer (flat, BKA join); Rowid-ordered scan -1 SIMPLE fi ref filt_aceid,filt_fh filt_aceid 8 test.a.id 1 17.14 Using where; Using join buffer (incremental, BKA join); Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index +1 SIMPLE a NULL ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where; Using join buffer (flat, BKA join); Rowid-ordered scan +1 SIMPLE fi NULL ref filt_aceid,filt_fh filt_aceid 8 test.a.id 1 17.14 Using where; Using join buffer (incremental, BKA join); Rowid-ordered scan Warnings: Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774) set statement optimizer_switch='rowid_filter=off' for select t.id, fi.* @@ -3023,10 +3023,10 @@ t.tp = 121 and a.atp = 1 and fi.fh in (6311439873746261694,-397087483897438286, 8518228073041491534,-5420422472375069774); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index -1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where; Using join buffer (flat, BKA join); Rowid-ordered scan -1 SIMPLE fi ref|filter filt_aceid,filt_fh filt_aceid|filt_fh 8|8 test.a.id 1 (17%) 17.14 Using where; Using join buffer (incremental, BKA join); Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index +1 SIMPLE a NULL ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where; Using join buffer (flat, BKA join); Rowid-ordered scan +1 SIMPLE fi NULL ref|filter filt_aceid,filt_fh filt_aceid|filt_fh 8|8 test.a.id 1 (17%) 17.14 Using where; Using join buffer (incremental, BKA join); Rowid-ordered scan; Using rowid filter Warnings: Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774) set statement optimizer_switch='rowid_filter=on' for select t.id, fi.* @@ -3196,10 +3196,10 @@ pk c1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE t1.c1 NOT IN (SELECT t2.c1 FROM t2, t1 AS a1 WHERE t2.i1 = t1.pk AND t2.i1 IS NOT NULL); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 15 100.00 Using where -2 DEPENDENT SUBQUERY t2 ref|filter c1,i1 c1|i1 3|5 func 6 (33%) 33.33 Using where; Full scan on NULL key; Using rowid filter -2 DEPENDENT SUBQUERY a1 ALL NULL NULL NULL NULL 15 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 15 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ref|filter c1,i1 c1|i1 3|5 func 6 (33%) 33.33 Using where; Full scan on NULL key; Using rowid filter +2 DEPENDENT SUBQUERY a1 NULL ALL NULL NULL NULL NULL 15 100.00 Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1` AS `c1` from `test`.`t1` where !<expr_cache><`test`.`t1`.`c1`,`test`.`t1`.`pk`>(<in_optimizer>(`test`.`t1`.`c1`,<exists>(/* select#2 */ select `test`.`t2`.`c1` from `test`.`t2` join `test`.`t1` `a1` where `test`.`t2`.`i1` = `test`.`t1`.`pk` and `test`.`t2`.`i1` is not null and trigcond(<cache>(`test`.`t1`.`c1`) = `test`.`t2`.`c1`)))) diff --git a/mysql-test/main/rowid_filter_innodb_debug.result b/mysql-test/main/rowid_filter_innodb_debug.result index 6fd75294bdb..aad0bd4ea45 100644 --- a/mysql-test/main/rowid_filter_innodb_debug.result +++ b/mysql-test/main/rowid_filter_innodb_debug.result @@ -36,9 +36,9 @@ explain select * from t2, t3 where t3.key1=t2.a and t3.key2 in (2,3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where -1 SIMPLE t3 ref|filter key1,key2 key1|key2 5|5 test.t2.a 1000 (20%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE t3 NULL ref|filter key1,key2 key1|key2 5|5 test.t2.a 1000 (20%) Using where; Using rowid filter set debug_sync='handler_rowid_filter_check SIGNAL at_rowid_filter_check WAIT_FOR go'; select * from t2, t3 where diff --git a/mysql-test/main/rowid_filter_myisam_debug.result b/mysql-test/main/rowid_filter_myisam_debug.result index 16fcb2a416e..1d2326a4dcd 100644 --- a/mysql-test/main/rowid_filter_myisam_debug.result +++ b/mysql-test/main/rowid_filter_myisam_debug.result @@ -35,9 +35,9 @@ explain select * from t2, t3 where t3.key1=t2.a and t3.key2 in (2,3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where -1 SIMPLE t3 ref|filter key1,key2 key1|key2 5|5 test.t2.a 1000 (18%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE t3 NULL ref|filter key1,key2 key1|key2 5|5 test.t2.a 1000 (18%) Using where; Using rowid filter set debug_sync='handler_rowid_filter_check SIGNAL at_rowid_filter_check WAIT_FOR go'; select * from t2, t3 where diff --git a/mysql-test/main/rowid_order_innodb.result b/mysql-test/main/rowid_order_innodb.result index 26fb8ebb707..6c5e6fde3bf 100644 --- a/mysql-test/main/rowid_order_innodb.result +++ b/mysql-test/main/rowid_order_innodb.result @@ -16,8 +16,8 @@ insert into t1 values (-5, 1, 1), (0, 1, 1), (10, 1, 1); explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 5 Using sort_union(key1,key2); Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,5 NULL 5 Using sort_union(key1,key2); Using where select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3; pk1 key1 key2 -100 1 1 diff --git a/mysql-test/main/rownum.result b/mysql-test/main/rownum.result index 3ad51c93260..8114c5e46d6 100644 --- a/mysql-test/main/rownum.result +++ b/mysql-test/main/rownum.result @@ -100,15 +100,15 @@ a b 2 20 1 10 explain select * from t1 where rownum() <= 2 order by a desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using filesort select t1.a,t1.b,rownum() from t1 where rownum() <= 2 order by a desc; a b rownum() 2 20 2 1 10 1 explain select t1.a,t1.b,rownum() from t1 where rownum() <= 2 order by a desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using temporary; Using filesort select *,rownum() from t1,t2; a b a b rownum() 1 10 2 21 1 @@ -727,9 +727,9 @@ show status like "Rows_read"; Variable_name Value Rows_read 2 explain extended select * from (select a from t1 where a < 1000) as tt where rownum() <= 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 /* select#1 */ select `tt`.`a` AS `a` from (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1000 limit 2) `tt` where rownum() <= 2 limit 2 prepare stmt from "select * from (select a from t1 where a < 1000) as tt where rownum() <= 2"; @@ -759,9 +759,9 @@ show status like "Rows_read"; Variable_name Value Rows_read 5 explain extended select * from (select a from t1 where a < 1000 group by a) as tt where rownum() <= 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `tt`.`a` AS `a` from (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1000 group by `test`.`t1`.`a` limit 2) `tt` where rownum() <= 2 limit 2 prepare stmt from "select * from (select a from t1 where a < 1000 group by a) as tt where rownum() <= 2"; @@ -783,9 +783,9 @@ show status like "Rows_read"; Variable_name Value Rows_read 5 explain extended select * from (select a from t1 where a < 1000 group by a order by 1) as tt where rownum() <= 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `tt`.`a` AS `a` from (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1000 group by `test`.`t1`.`a` order by 1 limit 2) `tt` where rownum() <= 2 limit 2 prepare stmt from "select * from (select a from t1 where a < 1000 group by a order by 1) as tt where rownum() <= 2"; @@ -807,11 +807,11 @@ show status like "Rows_read"; Variable_name Value Rows_read 5 explain extended select * from (select a from t1 where a < 1000 union select 10) as tt where rownum() <= 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using where -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `tt`.`a` AS `a` from (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1000 union /* select#3 */ select 10 AS `10` limit 2) `tt` where rownum() <= 2 limit 2 prepare stmt from "select * from (select a from t1 where a < 1000 union select 10) as tt where rownum() <= 2"; @@ -829,9 +829,9 @@ select * from (select a from t1 where a < 1000 group by a order by 1 limit 1) as a 1 explain extended select * from (select a from t1 where a < 1000 group by a order by 1 limit 1) as tt where rownum() <= 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `tt`.`a` AS `a` from (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1000 group by `test`.`t1`.`a` order by 1 limit 1) `tt` where rownum() <= 2 limit 2 prepare stmt from "select * from (select a from t1 where a < 1000 group by a order by 1 limit 1) as tt where rownum() <= 2"; @@ -848,9 +848,9 @@ a 1 2 explain extended select * from (select a from t1 where a < 1000 group by a order by 1 limit 10) as tt where rownum() <= 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `tt`.`a` AS `a` from (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1000 group by `test`.`t1`.`a` order by 1 limit 2) `tt` where rownum() <= 2 limit 2 prepare stmt from "select * from (select a from t1 where a < 1000 group by a order by 1 limit 10) as tt where rownum() <= 2"; @@ -867,11 +867,11 @@ select * from (select a from t1 where a < 1000 union select 10 limit 1) as tt wh a 1 explain extended select * from (select a from t1 where a < 1000 union select 10 limit 1) as tt where rownum() <= 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 100.00 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using where -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `tt`.`a` AS `a` from (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1000 union /* select#3 */ select 10 AS `10` limit 1) `tt` where rownum() <= 2 limit 2 prepare stmt from "select * from (select a from t1 where a < 1000 union select 10 limit 1) as tt where rownum() <= 2"; @@ -887,9 +887,9 @@ select * from (select a from t1 where a < 1000) as tt where rownum() < 2; a 1 explain extended select * from (select a from t1 where a < 1000) as tt where rownum() < 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 /* select#1 */ select `tt`.`a` AS `a` from (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1000 limit 1) `tt` where rownum() < 2 limit 1 prepare stmt from "select * from (select a from t1 where a < 1000) as tt where rownum() < 2"; @@ -906,9 +906,9 @@ a 1 2 explain extended select * from (select a from t1 where a < 1000) as tt where rownum() <= 1+1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 /* select#1 */ select `tt`.`a` AS `a` from (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1000 limit 2) `tt` where rownum() <= <cache>(1 + 1) limit 2 prepare stmt from "select * from (select a from t1 where a < 1000) as tt where rownum() <= 1+1"; @@ -927,9 +927,9 @@ a 1 2 explain extended select * from (select a from t1 where a < 1000) as tt where 1+1 >= rownum(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 /* select#1 */ select `tt`.`a` AS `a` from (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1000 limit 2) `tt` where <cache>(1 + 1) >= rownum() limit 2 prepare stmt from "select * from (select a from t1 where a < 1000) as tt where 1+1 >= rownum()"; @@ -951,10 +951,10 @@ a 4 5 explain extended select * from (select a from t1 where a < 1000) as tt where (select max(a) from t1) >= rownum(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 100.00 Using where -3 SUBQUERY t1 ALL NULL NULL NULL NULL 5 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 Using where +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 5 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 /* select#1 */ select `tt`.`a` AS `a` from (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1000 limit 5) `tt` where (/* select#3 */ select max(`test`.`t1`.`a`) from `test`.`t1`) >= rownum() limit 5 prepare stmt from "select * from (select a from t1 where a < 1000) as tt where (select max(a) from t1) >= rownum()"; diff --git a/mysql-test/main/second_frac-9175.result b/mysql-test/main/second_frac-9175.result index dbf268b5c3b..7c937ad4ad1 100644 --- a/mysql-test/main/second_frac-9175.result +++ b/mysql-test/main/second_frac-9175.result @@ -2,8 +2,8 @@ select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.1234 timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456') 31622400123456 explain extended select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select timestampdiff(MICROSECOND,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456') AS `timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456')` create view v1 as select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456'); diff --git a/mysql-test/main/select.result b/mysql-test/main/select.result index 2f051ab33bf..3004c3c941a 100644 --- a/mysql-test/main/select.result +++ b/mysql-test/main/select.result @@ -131,20 +131,20 @@ fld3 select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%'; fld3 explain select t2.fld3 from t2 where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3,not_used); ERROR 42000: Key 'not_used' doesn't exist in table 't2' explain select fld3 from t2 use index (not_used); @@ -154,8 +154,8 @@ fld3 honeysuckle honoring explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld3 fld3 30 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 Using where; Using index select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3; fld1 fld3 148504 Colombo @@ -174,8 +174,8 @@ fld1 250501 250502 explain select fld1 from t2 where fld1=250501 or fld1="250502"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld1 fld1 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 Using where; Using index select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502; fld1 250501 @@ -183,8 +183,8 @@ fld1 250505 250601 explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 Using where; Using index select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; fld1 fld3 012001 flanking @@ -600,21 +600,21 @@ companynr rtrim(space(512+companynr)) select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3; fld3 explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort -1 SIMPLE t3 ref period period 4 test.t1.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index period period 4 NULL 1 -1 SIMPLE t1 ref period period 4 test.t3.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL index period period 4 NULL 1 +1 SIMPLE t1 NULL ref period period 4 test.t3.period 4181 explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index period period 4 NULL 1 -1 SIMPLE t3 ref period period 4 test.t1.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index period period 4 NULL 1 +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 select period from t1; period 9410 @@ -627,9 +627,9 @@ select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3. fld3 period breaking 1001 explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const fld1 fld1 4 const 1 -1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const fld1 fld1 4 const 1 +1 SIMPLE t3 NULL const PRIMARY,period PRIMARY 4 const 1 select fld3,period from t2,t1 where companynr*10 = 37*10; fld3 period breaking 9410 @@ -1359,81 +1359,81 @@ select count(*) from t2 left join t4 using (companynr) where t4.companynr is not count(*) 1199 explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 Using where; Not exists select companynr,companyname from t2 left join t4 using (companynr) where companynr is null; companynr companyname select count(*) from t2 left join t4 using (companynr) where companynr is not null; count(*) 1200 explain select companynr,companyname from t2 left join t4 using (companynr) where companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE delete from t2 where fld1=999999; explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; companynr companynr 37 36 41 40 explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL index NULL PRIMARY 1 NULL 12 Using index; Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join) select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008; fld1 companynr fld3 period 038008 37 reporters 1008 @@ -1506,8 +1506,8 @@ select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069 explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>""; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; @@ -1947,11 +1947,11 @@ select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = fld1 sum(price) 038008 234298 explain select fld3 from t2 where 1>2 or 2>3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select fld3 from t2 where fld1=fld1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502; companynr fld1 34 250501 @@ -2002,8 +2002,8 @@ select count(*) from t3 where companynr=512 and price2=76234234; count(*) 4181 explain select min(fld1),max(fld1),count(*) from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(fld1),max(fld1),count(*) from t2; min(fld1) max(fld1) count(*) 0 1232609 1199 @@ -2328,11 +2328,11 @@ insert into t2 values (1); insert into t4 values (1,1); explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE t4 const id4 NULL NULL NULL 1 -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t4 NULL const id4 NULL NULL NULL 1 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 Using where select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; id1 id2 id3 id4 id44 @@ -2363,17 +2363,17 @@ create table t2 (c integer, d integer, index(c), index(d)); insert into t1 values (1,2), (2,2), (3,2), (4,2); insert into t2 values (1,3), (2,3), (3,4), (4,4); explain select * from t1 left join t2 on a=c where d in (4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref c,d d 5 const 2 -1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref c,d d 5 const 2 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) select * from t1 left join t2 on a=c where d in (4); a b c d 3 2 3 4 4 2 4 4 explain select * from t1 left join t2 on a=c where d = 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref c,d d 5 const 2 -1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref c,d d 5 const 2 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) select * from t1 left join t2 on a=c where d = 4; a b c d 3 2 3 4 @@ -2389,8 +2389,8 @@ INSERT INTO t1 VALUES (1,'a'); INSERT INTO t1 VALUES (2,'b'); INSERT INTO t1 VALUES (3,'c'); EXPLAIN SELECT i FROM t1 WHERE i=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index DROP TABLE t1; CREATE TABLE t1 ( a BLOB, INDEX (a(20)) ); CREATE TABLE t2 ( a BLOB, INDEX (a(20)) ); @@ -2398,13 +2398,13 @@ INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five'); INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref a a 23 test.t1.a 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref a a 23 test.t1.a 2 Using where EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref a a 23 test.t1.a 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref a a 23 test.t1.a 2 Using where DROP TABLE t1, t2; CREATE TABLE t1 ( city char(30) ); INSERT INTO t1 VALUES ('London'); @@ -2416,14 +2416,14 @@ SELECT * FROM t1 WHERE city='london'; city London EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE city='London' AND city='london'; city London EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; city London @@ -2581,8 +2581,8 @@ create table t2 (a tinyint unsigned); create index t2i on t2(a); insert into t2 values (0), (254), (255); explain select * from t2 where a > -1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index t2i t2i 2 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index t2i t2i 2 NULL 3 Using where; Using index select * from t2 where a > -1; a 0 @@ -2719,16 +2719,16 @@ insert into t3 values (1,1),(1,2); explain select straight_join DISTINCT t2.a,t2.b, t1.c from t1, t3, t2 where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and t2.b like '%%' order by t2.b limit 0,1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref b,c b 5 const 1 Using temporary; Using filesort -1 SIMPLE t3 index PRIMARY,a,b PRIMARY 8 NULL 2 Using index; Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref b,c b 5 const 1 Using temporary; Using filesort +1 SIMPLE t3 NULL index PRIMARY,a,b PRIMARY 8 NULL 2 Using index; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) DROP TABLE t1,t2,t3; CREATE TABLE t1 (a int, INDEX idx(a)); INSERT INTO t1 VALUES (2), (3), (1); EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 EXPLAIN SELECT * FROM t1 IGNORE INDEX (a); ERROR 42000: Key 'a' doesn't exist in table 't1' EXPLAIN SELECT * FROM t1 FORCE INDEX (a); @@ -2740,9 +2740,9 @@ CREATE TABLE t2 (a int PRIMARY KEY, b int, KEY b (b)); INSERT INTO t2 VALUES (1,NULL), (2,10); ALTER TABLE t1 ENABLE KEYS; EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b b 5 NULL 2 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index b b 5 NULL 2 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; a b a b 1 NULL 1 1 @@ -2750,9 +2750,9 @@ a b a b 1 NULL 4 10 2 10 4 10 EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b b 5 NULL 2 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index b b 5 NULL 2 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; a b a b 1 NULL 1 1 @@ -2765,27 +2765,27 @@ CREATE TABLE t2 (key2 float default NULL, UNIQUE KEY key2 (key2)); INSERT INTO t1 VALUES (0.3762),(0.3845),(0.6158),(0.7941); INSERT INTO t2 VALUES (1.3762),(1.3845),(1.6158),(1.7941); explain select max(key1) from t1 where key1 <= 0.6158; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select max(key2) from t2 where key2 <= 1.6158; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select min(key1) from t1 where key1 >= 0.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select min(key2) from t2 where key2 >= 1.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select max(key1), min(key2) from t1, t2 where key1 <= 0.6158 and key2 >= 1.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range key1 key1 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 3 Using where; Using index explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range key1 key1 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 3 Using where; Using index select max(key1) from t1 where key1 <= 0.6158; max(key1) 0.6158 @@ -2912,13 +2912,13 @@ a 2 4 EXPLAIN SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) EXPLAIN SELECT t1.a FROM t1 INNER JOIN t2 ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) DROP TABLE t1,t2; select x'3136' + 0, X'3136' + 0, b'10' + 0, B'10' + 0; x'3136' + 0 X'3136' + 0 b'10' + 0 B'10' + 0 @@ -3351,10 +3351,10 @@ EXPLAIN SELECT t2.key_a,foo FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a INNER JOIN t3 ON t1.key_a = t3.key_a WHERE t2.key_a=2 and key_b=5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 8 const,const 1 SELECT t2.key_a,foo FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a INNER JOIN t3 ON t1.key_a = t3.key_a @@ -3365,10 +3365,10 @@ EXPLAIN SELECT t2.key_a,foo FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a INNER JOIN t3 ON t1.key_a = t3.key_a WHERE t2.key_a=2 and key_b=5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 8 const,const 1 DROP TABLE t1,t2,t3; create table t1 (f1 int); insert into t1 values(1),(2); @@ -3419,9 +3419,9 @@ sku sppr name sku pr EXPLAIN SELECT t2.sku, t2.sppr, t2.name, t1.sku, t1.pr FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 Using index condition DROP TABLE t1,t2; SET SQL_MODE='NO_UNSIGNED_SUBTRACTION'; CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL); @@ -3459,9 +3459,9 @@ Z In next EXPLAIN, B.rows must be exactly 10: explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5 and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A range PRIMARY PRIMARY 12 NULL 4 Using index condition; Using where -1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL range PRIMARY PRIMARY 12 NULL 4 Using index condition; Using where +1 SIMPLE B NULL ref PRIMARY PRIMARY 8 const,test.A.e 10 drop table t1, t2; CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b)); INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2), @@ -3473,14 +3473,14 @@ INSERT INTO t2 VALUES (0,0,0), (0,0,1), (8,0,0), (8,0,1), (9,0,0), (9,0,1); EXPLAIN SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where -1 SIMPLE t1 eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL c NULL NULL NULL 18 Using where +1 SIMPLE t1 NULL eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using rowid filter EXPLAIN SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where -1 SIMPLE t1 eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL c NULL NULL NULL 18 Using where +1 SIMPLE t1 NULL eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using rowid filter DROP TABLE t1, t2; create table t1 ( a int unsigned not null auto_increment primary key, @@ -3520,13 +3520,13 @@ INSERT INTO t2 VALUES (3), (3), (4); EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 ref idx idx 4 const 8 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL ref idx idx 4 const 8 Using index EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 ref idx idx 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL ref idx idx 4 const 1 Using index DROP TABLE t1, t2; CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a int); INSERT INTO t1 VALUES (1,2), (2,NULL), (3,2); @@ -3537,10 +3537,10 @@ INSERT INTO t3 VALUES (2,10), (2,20), (1,30), (2,40), (2,50), (1,60), (3,70), (1 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id WHERE t1.id=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 const idx1 NULL NULL NULL 1 -1 SIMPLE t3 ref idx1 idx1 5 const 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL const idx1 NULL NULL NULL 1 +1 SIMPLE t3 NULL ref idx1 idx1 5 const 4 SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id WHERE t1.id=2; id a b c d e @@ -3568,21 +3568,21 @@ INSERT INTO t2 VALUES EXPLAIN SELECT t2.* FROM t1 JOIN t2 ON t2.fk=t1.pk WHERE t2.fk < 'c' AND t2.pk=t1.fk; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where EXPLAIN SELECT t2.* FROM t1 JOIN t2 ON t2.fk=t1.pk WHERE t2.fk BETWEEN 'a' AND 'b' AND t2.pk=t1.fk; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where EXPLAIN SELECT t2.* FROM t1 JOIN t2 ON t2.fk=t1.pk WHERE t2.fk IN ('a','b') AND t2.pk=t1.fk; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where DROP TABLE t1,t2; CREATE TABLE t1 (a int, b varchar(20) NOT NULL, PRIMARY KEY(a)); CREATE TABLE t2 (a int, b varchar(20) NOT NULL, @@ -3590,8 +3590,8 @@ PRIMARY KEY (a), UNIQUE KEY (b)); INSERT INTO t1 VALUES (1,'a'),(2,'b'),(3,'c'); INSERT INTO t2 VALUES (1,'a'),(2,'b'),(3,'c'); EXPLAIN SELECT t1.a FROM t1 LEFT JOIN t2 ON t2.b=t1.b WHERE t1.a=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 DROP TABLE t1,t2; CREATE TABLE t1(id int PRIMARY KEY, b int, e int); CREATE TABLE t2(i int, a int, INDEX si(i), INDEX ai(a)); @@ -3613,34 +3613,34 @@ EXPLAIN SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3 WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND t3.a=t2.a AND t3.c IN ('bb','ee'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using where -1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range si si 5 NULL 4 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter EXPLAIN SELECT t3.a FROM t1,t2,t3 WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND t3.a=t2.a AND t3.c IN ('bb','ee') ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using where -1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range si,ai si 5 NULL 4 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter EXPLAIN SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3 WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND t3.c IN ('bb','ee'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si si 5 NULL 2 Using index condition; Using where -1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range si si 5 NULL 2 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter EXPLAIN SELECT t3.a FROM t1,t2,t3 WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND t3.c IN ('bb','ee'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si,ai si 5 NULL 2 Using index condition; Using where -1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range si,ai si 5 NULL 2 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter DROP TABLE t1,t2,t3; CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int); CREATE TABLE t2 ( f11 int PRIMARY KEY ); @@ -3675,13 +3675,13 @@ SELECT COUNT(*) FROM t1 WHERE ID_better=1; COUNT(*) 2 EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 Using where DROP INDEX idx1 ON t1; CREATE UNIQUE INDEX idx1 ON t1(ID_with_null); EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 Using where DROP TABLE t1; CREATE TABLE t1 ( ID1_with_null int NULL, @@ -3716,35 +3716,35 @@ COUNT(*) 2 EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (6%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (6%) Using where; Using rowid filter EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null=3 IS NULL ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where DROP INDEX idx1 ON t1; CREATE UNIQUE INDEX idx1 ON t1(ID1_with_null,ID2_with_null); EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (7%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (7%) Using where; Using rowid filter EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null IS NULL ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND (ID2_with_null=1 OR ID2_with_null=2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter idx1,idx2 idx1|idx2 5|4 const 2 (1%) Using index condition; Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx1|idx2 5|4 const 2 (1%) Using index condition; Using where; Using rowid filter DROP TABLE t1; CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY ts(ts)); INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00"); @@ -3763,9 +3763,9 @@ EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30 AND t1.ts BETWEEN t2.dt1 AND t2.dt2 AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t1 range ts ts 4 NULL 2 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t1 NULL range ts ts 4 NULL 2 Using index condition; Using where SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30 AND t1.ts BETWEEN t2.dt1 AND t2.dt2 AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31"; @@ -3848,16 +3848,16 @@ cc 3 7 cc 2 5 cc 5 3 EXPLAIN SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref name name 6 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref name name 6 const 4 Using where SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; name LENGTH(name) n cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range name name 6 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 Using where SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%'; name LENGTH(name) n cc 5 3 @@ -3865,8 +3865,8 @@ cc 4 4 cc 2 5 cc 3 7 EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range name name 6 NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 Using where; Using filesort SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name; name LENGTH(name) n cc 4 4 @@ -3874,9 +3874,9 @@ cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref name name 6 test.t1.name 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref name name 6 test.t1.name 2 Using where SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; name name n ccc NULL NULL @@ -3941,16 +3941,16 @@ cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref name name 6 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref name name 6 const 4 Using where SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; name LENGTH(name) n cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range name name 6 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 Using where SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%'; name LENGTH(name) n cc 5 3 @@ -3958,8 +3958,8 @@ cc 4 4 cc 2 5 cc 3 7 EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range name name 6 NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 Using where; Using filesort SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name; name LENGTH(name) n cc 4 4 @@ -3967,9 +3967,9 @@ cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref name name 6 test.t1.name 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref name name 6 test.t1.name 2 Using where SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; name name n ccc NULL NULL @@ -4030,17 +4030,17 @@ INSERT INTO t1 VALUES (1,1), (1,2), (1,3), (1,4), (1,5), (1, 6), (1,7); EXPLAIN SELECT COUNT(*) FROM t1 f1 INNER JOIN t1 f2 ON ( f1.b=f2.b AND f1.a<f2.a ) WHERE 1 AND f1.b NOT IN (100,2232,3343,51111); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE f1 range inx inx 5 NULL 7 Using where; Using index -1 SIMPLE f2 ref inx inx 5 test.f1.b 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE f1 NULL range inx inx 5 NULL 7 Using where; Using index +1 SIMPLE f2 NULL ref inx inx 5 test.f1.b 1 Using where; Using index DROP TABLE t1; CREATE TABLE t1 (c1 INT, c2 INT); INSERT INTO t1 VALUES (1,11), (2,22), (2,22); EXPLAIN SELECT c1 FROM t1 WHERE (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT COUNT(c2)))))))))))))))))))))))))))))))) > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -31 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -32 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +31 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +32 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used EXPLAIN SELECT c1 FROM t1 WHERE (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT COUNT(c2))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) > 0; ERROR HY000: Too high level of nesting for select DROP TABLE t1; @@ -4093,8 +4093,8 @@ join_2.c1, join_7.c1, join_1.c1, join_0.c1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select NULL AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by NULL,NULL,NULL,NULL,NULL SHOW WARNINGS; @@ -4436,13 +4436,13 @@ drop table t1, t2, t3; CREATE TABLE t1 (a INT KEY, b INT); INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4); EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2 EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2 DROP TABLE t1; @@ -4455,9 +4455,9 @@ INSERT INTO t1 VALUES (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')), (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')); EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1) SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2; 1 1 @@ -4465,9 +4465,9 @@ SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2; 1 1 EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1) SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a); 1 1 @@ -4511,8 +4511,8 @@ SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; a 2001-01-01 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a` from dual where 1 DROP TABLE t1; @@ -4522,8 +4522,8 @@ SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; a 2001-01-01 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01' AS `a` from dual where 1 DROP TABLE t1; @@ -4533,8 +4533,8 @@ SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; a 2001-01-01 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a` from dual where 1 DROP TABLE t1; @@ -4544,8 +4544,8 @@ SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; a b 2001-01-01 00:00:00 2001-01-01 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 1 DROP TABLE t1; @@ -4554,16 +4554,16 @@ INSERT INTO t1 VALUES('2001-01-01', '2001-01-01'); SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; a b EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 0 SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01'; a b 2001-01-01 00:00:00 2001-01-01 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 1 DROP TABLE t1; @@ -4579,10 +4579,10 @@ EXPLAIN EXTENDED SELECT x.a, y.a, z.a FROM t1 x JOIN t1 y ON x.a=y.a JOIN t1 z ON y.a=z.a WHERE x.a='2001-01-01' AND z.a='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x system NULL NULL NULL NULL 1 100.00 -1 SIMPLE y system NULL NULL NULL NULL 1 100.00 -1 SIMPLE z system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE x NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE y NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE z NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a` from dual where 1 DROP TABLE t1; @@ -4598,8 +4598,8 @@ INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12; INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12; INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12; EXPLAIN SELECT a FROM t1 ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 SELECT a FROM t1 ORDER BY a; DROP TABLE t1; CREATE TABLE t1(a CHAR(0) NOT NULL, b CHAR(0) NOT NULL, c int); @@ -4608,8 +4608,8 @@ INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12; INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12; INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12; EXPLAIN SELECT a FROM t1 ORDER BY a LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 SELECT a FROM t1 ORDER BY a LIMIT 5; a @@ -4618,8 +4618,8 @@ a EXPLAIN SELECT * FROM t1 ORDER BY a, b LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 SELECT * FROM t1 ORDER BY a, b LIMIT 5; a b c 0 @@ -4628,8 +4628,8 @@ a b c 0 2 EXPLAIN SELECT * FROM t1 ORDER BY a, b, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 Using filesort SELECT * FROM t1 ORDER BY a, b, c LIMIT 5; a b c 0 @@ -4638,8 +4638,8 @@ a b c 0 0 EXPLAIN SELECT * FROM t1 ORDER BY c, a LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 Using filesort SELECT * FROM t1 ORDER BY c, a LIMIT 5; a b c 0 @@ -4695,8 +4695,8 @@ DROP TABLE t1,t2; CREATE TABLE t1 (a INT NOT NULL, b INT); INSERT INTO t1 VALUES (1, 1); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select 1 AS `a`,1 AS `b` from dual where 1 SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; @@ -4705,18 +4705,18 @@ a b DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 DROP TABLE t1; @@ -4810,39 +4810,39 @@ SELECT * FROM t1 WHERE a = 1 + 1; a 2 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = <cache>(1 + 1) SELECT * FROM t1 HAVING a = 1 + 1; a 2 EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having `test`.`t1`.`a` = <cache>(1 + 1) SELECT * FROM t1, t2 WHERE a = b + (1 + 1); a b 4 2 EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a = b + (1 + 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where `test`.`t1`.`a` = <cache>(2 + (1 + 1)) SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1; b a 2 3 EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select 2 AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > <cache>(unix_timestamp('2009-03-10 00:00:00')) CREATE FUNCTION f1() RETURNS INT DETERMINISTIC @@ -4858,8 +4858,8 @@ SELECT @cnt; @cnt 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = f1(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = <cache>(`f1`()) DROP TABLE t1, t2; @@ -4915,8 +4915,8 @@ DROP TABLE t1; CREATE TABLE t1(a ENUM('') NOT NULL); INSERT INTO t1 VALUES (), (), (); EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using filesort SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; 1 1 @@ -4943,13 +4943,13 @@ INSERT INTO t6 VALUES (9),(7); SET @save_join_buffer_size=@@join_buffer_size,@@join_buffer_size = 2176; EXPLAIN SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 12 -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.f1 1 -1 SIMPLE t5 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 4 test.t1.f1 1 +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; f1 f1 f1 f1 f2 f1 f1 3 9 NULL NULL NULL 20 9 @@ -5026,20 +5026,20 @@ INSERT INTO t3 VALUES set @tmp= @@optimizer_switch; SET SESSION optimizer_switch='index_condition_pushdown=off'; EXPLAIN SELECT * from t1,t2,t3 WHERE t3.a3=t1.a1 AND t2.a2=t1.a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL idx NULL NULL NULL 3 -1 SIMPLE t2 ref idx idx 4 test.t1.a1 2 -1 SIMPLE t3 ref idx idx 4 test.t1.a1 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.a2=t1.a1 AND t3.a3=t1.a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL idx NULL NULL NULL 3 -1 SIMPLE t2 ref idx idx 4 test.t1.a1 2 -1 SIMPLE t3 ref idx idx 4 test.t1.a1 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.a2=t1.a1 AND t3.a3=t2.a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL idx NULL NULL NULL 3 -1 SIMPLE t2 ref idx idx 4 test.t1.a1 2 -1 SIMPLE t3 ref idx idx 4 test.t1.a1 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 SELECT * from t1,t2,t3 WHERE t3.a3=t1.a1 AND t2.a2=t1.a1 AND LENGTH(CONCAT(CONCAT(t1.b1,t2.b2),t3.b3)) <= 7; @@ -5129,14 +5129,14 @@ LEFT JOIN (((t4 JOIN t5 ON t4.f42=t5.f51) LEFT JOIN t6 ON t6.f62>0) JOIN t7 ON t6.f61>0) ON t3.f31 = t6.f61 WHERE t7.f71>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system PRIMARY,f32 NULL NULL NULL 1 -1 SIMPLE t5 system PRIMARY NULL NULL NULL 1 -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 ref f22 f22 5 const 1 -1 SIMPLE t4 ref f42 f42 5 const 1 Using index -1 SIMPLE t6 ref f61 f61 5 const 1 Using where -1 SIMPLE t7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL system PRIMARY,f32 NULL NULL NULL 1 +1 SIMPLE t5 NULL system PRIMARY NULL NULL NULL 1 +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL ref f22 f22 5 const 1 +1 SIMPLE t4 NULL ref f42 f42 5 const 1 Using index +1 SIMPLE t6 NULL ref f61 f61 5 const 1 Using where +1 SIMPLE t7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) SELECT t2.f23 FROM (t1 LEFT JOIN (t2 JOIN t3 ON t2.f22=t3.f32) ON t1.f11=t3.f31) LEFT JOIN @@ -5190,8 +5190,8 @@ LEFT OUTER JOIN (t2 INNER JOIN t_empty ON TRUE) ON t1.pk=t2.pk WHERE t2.pk <> 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 @@ -5208,8 +5208,8 @@ LEFT OUTER JOIN (t2 CROSS JOIN t_empty) ON t1.pk=t2.pk WHERE t2.pk <> 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 @@ -5226,8 +5226,8 @@ LEFT OUTER JOIN (t2 INNER JOIN t_empty ON t_empty.i=t2.i) ON t1.pk=t2.pk WHERE t2.pk <> 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 @@ -5256,8 +5256,8 @@ INSERT INTO `CC` VALUES ,'x'); EXPLAIN SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4 HAVING G1 ORDER BY `varchar_key` LIMIT 6 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CC range int_key int_key 4 NULL 9 Using index condition; Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE CC NULL range int_key int_key 4 NULL 9 Using index condition; Using where; Using filesort SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4 HAVING G1 ORDER BY `varchar_key` LIMIT 6 ; G1 @@ -5279,8 +5279,8 @@ a b 2 2 EXPLAIN SELECT * FROM t1 WHERE a = b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 DROP TABLE t1; # # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on @@ -5401,8 +5401,8 @@ SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0; pk a EXPLAIN EXTENDED SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 2 AS `pk`,0 AS `a` from `test`.`t1` where 0 DROP TABLE t1; @@ -5423,9 +5423,9 @@ INSERT INTO t2 VALUES (8), (9); EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON ( c = a ) WHERE 1 IS NULL OR b < 33 AND b = c; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system idx NULL NULL NULL 1 100.00 -1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system idx NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL ref idx idx 5 const 1 100.00 Using index Warnings: Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` = 8 SELECT * FROM t1 INNER JOIN t2 ON ( c = a ) @@ -5454,8 +5454,8 @@ CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,101),(2,102),(3,103),(4,104),(5,11); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1); @@ -5463,8 +5463,8 @@ a b 5 11 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5); @@ -5472,8 +5472,8 @@ a b 5 11 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1); @@ -5481,16 +5481,16 @@ a b 5 11 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (b = 1 OR a = 1) AND (b = 5 AND a = 5 OR 1 != 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where 0 SELECT * FROM t1 WHERE (b = 1 OR a = 1) AND (b = 5 AND a = 5 OR 1 != 1); a b EXPLAIN EXTENDED SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 5 and `test`.`t1`.`a` = 5 SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1); @@ -5506,9 +5506,9 @@ CREATE TABLE t2 (c varchar(1), d varchar(1)) ENGINE=MyISAM; INSERT INTO t2 VALUES ('k','k'); EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where `test`.`t1`.`b` = 'k' and `test`.`t1`.`a` = 136 SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b)); @@ -5525,8 +5525,8 @@ INSERT INTO t2 VALUES (8), (9); EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0 SELECT * FROM t1, t2 @@ -5547,9 +5547,9 @@ pk1 a1 b1 pk2 a2 EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a1 = pk2 AND ( ( b1 = 6 OR a2 > 4 ) AND pk2 = a2 OR pk1 IS NULL ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system PRIMARY NULL NULL NULL 1 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where `test`.`t1`.`a1` = 1 and `test`.`t1`.`b1` = 6 INSERT INTO t1 VALUES (3,1,6); diff --git a/mysql-test/main/select_debug.result b/mysql-test/main/select_debug.result index dfe49aed215..469951e9d2b 100644 --- a/mysql-test/main/select_debug.result +++ b/mysql-test/main/select_debug.result @@ -9,9 +9,9 @@ set session join_cache_level=3; SET @saved_dbug = @@SESSION.debug_dbug; set @@debug_dbug= 'd,opt'; explain select t1.b from t1,t2 where t1.b=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.b 2 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 5 test.t1.b 2 Using where; Using join buffer (flat, BNLH join) select t1.b from t1,t2 where t1.b=t2.a; b 2 diff --git a/mysql-test/main/select_found.result b/mysql-test/main/select_found.result index 2c37c2d28d8..ee305498682 100644 --- a/mysql-test/main/select_found.result +++ b/mysql-test/main/select_found.result @@ -82,9 +82,9 @@ PRIMARY KEY (id), UNIQUE KEY e_n (email,name) ); EXPLAIN SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system PRIMARY,kid NULL NULL NULL 0 Const row not found; Using temporary -1 SIMPLE t2 ALL NULL NULL NULL NULL 200 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system PRIMARY,kid NULL NULL NULL 0 Const row not found; Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 200 SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10; email email1 diff --git a/mysql-test/main/select_jcl6.result b/mysql-test/main/select_jcl6.result index 6a309d8aa69..270f5555d9c 100644 --- a/mysql-test/main/select_jcl6.result +++ b/mysql-test/main/select_jcl6.result @@ -142,20 +142,20 @@ fld3 select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%'; fld3 explain select t2.fld3 from t2 where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3,not_used); ERROR 42000: Key 'not_used' doesn't exist in table 't2' explain select fld3 from t2 use index (not_used); @@ -165,8 +165,8 @@ fld3 honeysuckle honoring explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld3 fld3 30 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 Using where; Using index select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3; fld1 fld3 148504 Colombo @@ -185,8 +185,8 @@ fld1 250501 250502 explain select fld1 from t2 where fld1=250501 or fld1="250502"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld1 fld1 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 Using where; Using index select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502; fld1 250501 @@ -194,8 +194,8 @@ fld1 250505 250601 explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 Using where; Using index select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; fld1 fld3 012001 flanking @@ -611,21 +611,21 @@ companynr rtrim(space(512+companynr)) select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3; fld3 explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort -1 SIMPLE t3 ref period period 4 test.t1.period 4181 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 Using temporary; Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL period NULL NULL NULL 41810 Using temporary; Using filesort -1 SIMPLE t1 ref period period 4 test.t3.period 4181 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL period NULL NULL NULL 41810 Using temporary; Using filesort +1 SIMPLE t1 NULL ref period period 4 test.t3.period 4181 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort -1 SIMPLE t3 ref period period 4 test.t1.period 4181 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 Using temporary; Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan select period from t1; period 9410 @@ -638,9 +638,9 @@ select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3. fld3 period breaking 1001 explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const fld1 fld1 4 const 1 -1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const fld1 fld1 4 const 1 +1 SIMPLE t3 NULL const PRIMARY,period PRIMARY 4 const 1 select fld3,period from t2,t1 where companynr*10 = 37*10; fld3 period breaking 9410 @@ -1370,81 +1370,81 @@ select count(*) from t2 left join t4 using (companynr) where t4.companynr is not count(*) 1199 explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 1 test.t4.companynr 1200 Using where; Not exists; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1200 Using where; Not exists; Using join buffer (flat, BNLH join) select companynr,companyname from t2 left join t4 using (companynr) where companynr is null; companynr companyname select count(*) from t2 left join t4 using (companynr) where companynr is not null; count(*) 1200 explain select companynr,companyname from t2 left join t4 using (companynr) where companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE delete from t2 where fld1=999999; explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t2 hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 Using where; Using join buffer (flat, BNLH join) select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; companynr companynr 37 36 41 40 explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary -1 SIMPLE t2 hash_ALL NULL #hash#$hj 1 func 1199 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL index NULL PRIMARY 1 NULL 12 Using index; Using temporary +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 func 1199 Using where; Using join buffer (flat, BNLH join) select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008; fld1 companynr fld3 period 038008 37 reporters 1008 @@ -1517,8 +1517,8 @@ select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069 explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>""; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; @@ -1958,11 +1958,11 @@ select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = fld1 sum(price) 038008 234298 explain select fld3 from t2 where 1>2 or 2>3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select fld3 from t2 where fld1=fld1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502; companynr fld1 34 250501 @@ -2013,8 +2013,8 @@ select count(*) from t3 where companynr=512 and price2=76234234; count(*) 4181 explain select min(fld1),max(fld1),count(*) from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(fld1),max(fld1),count(*) from t2; min(fld1) max(fld1) count(*) 0 1232609 1199 @@ -2339,11 +2339,11 @@ insert into t2 values (1); insert into t4 values (1,1); explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE t4 const id4 NULL NULL NULL 1 -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 hash_ALL NULL #hash#$hj 4 test.t1.id1 1 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t4 NULL const id4 NULL NULL NULL 1 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 4 test.t1.id1 1 Using where; Using join buffer (flat, BNLH join) select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; id1 id2 id3 id4 id44 @@ -2374,17 +2374,17 @@ create table t2 (c integer, d integer, index(c), index(d)); insert into t1 values (1,2), (2,2), (3,2), (4,2); insert into t2 values (1,3), (2,3), (3,4), (4,4); explain select * from t1 left join t2 on a=c where d in (4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref c,d d 5 const 2 -1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref c,d d 5 const 2 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) select * from t1 left join t2 on a=c where d in (4); a b c d 3 2 3 4 4 2 4 4 explain select * from t1 left join t2 on a=c where d = 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref c,d d 5 const 2 -1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref c,d d 5 const 2 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) select * from t1 left join t2 on a=c where d = 4; a b c d 3 2 3 4 @@ -2400,8 +2400,8 @@ INSERT INTO t1 VALUES (1,'a'); INSERT INTO t1 VALUES (2,'b'); INSERT INTO t1 VALUES (3,'c'); EXPLAIN SELECT i FROM t1 WHERE i=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index DROP TABLE t1; CREATE TABLE t1 ( a BLOB, INDEX (a(20)) ); CREATE TABLE t2 ( a BLOB, INDEX (a(20)) ); @@ -2409,13 +2409,13 @@ INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five'); INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref a a 23 test.t1.a 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref a a 23 test.t1.a 2 Using where EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref a a 23 test.t1.a 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref a a 23 test.t1.a 2 Using where DROP TABLE t1, t2; CREATE TABLE t1 ( city char(30) ); INSERT INTO t1 VALUES ('London'); @@ -2427,14 +2427,14 @@ SELECT * FROM t1 WHERE city='london'; city London EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE city='London' AND city='london'; city London EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; city London @@ -2592,8 +2592,8 @@ create table t2 (a tinyint unsigned); create index t2i on t2(a); insert into t2 values (0), (254), (255); explain select * from t2 where a > -1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index t2i t2i 2 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index t2i t2i 2 NULL 3 Using where; Using index select * from t2 where a > -1; a 0 @@ -2730,16 +2730,16 @@ insert into t3 values (1,1),(1,2); explain select straight_join DISTINCT t2.a,t2.b, t1.c from t1, t3, t2 where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and t2.b like '%%' order by t2.b limit 0,1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref b,c b 5 const 1 Using temporary; Using filesort -1 SIMPLE t3 index PRIMARY,a,b PRIMARY 8 NULL 2 Using index; Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref b,c b 5 const 1 Using temporary; Using filesort +1 SIMPLE t3 NULL index PRIMARY,a,b PRIMARY 8 NULL 2 Using index; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) DROP TABLE t1,t2,t3; CREATE TABLE t1 (a int, INDEX idx(a)); INSERT INTO t1 VALUES (2), (3), (1); EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 EXPLAIN SELECT * FROM t1 IGNORE INDEX (a); ERROR 42000: Key 'a' doesn't exist in table 't1' EXPLAIN SELECT * FROM t1 FORCE INDEX (a); @@ -2751,9 +2751,9 @@ CREATE TABLE t2 (a int PRIMARY KEY, b int, KEY b (b)); INSERT INTO t2 VALUES (1,NULL), (2,10); ALTER TABLE t1 ENABLE KEYS; EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b b 5 NULL 2 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index b b 5 NULL 2 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; a b a b 1 NULL 1 1 @@ -2761,9 +2761,9 @@ a b a b 1 NULL 4 10 2 10 4 10 EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b b 5 NULL 2 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index b b 5 NULL 2 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; a b a b 1 NULL 1 1 @@ -2776,27 +2776,27 @@ CREATE TABLE t2 (key2 float default NULL, UNIQUE KEY key2 (key2)); INSERT INTO t1 VALUES (0.3762),(0.3845),(0.6158),(0.7941); INSERT INTO t2 VALUES (1.3762),(1.3845),(1.6158),(1.7941); explain select max(key1) from t1 where key1 <= 0.6158; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select max(key2) from t2 where key2 <= 1.6158; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select min(key1) from t1 where key1 >= 0.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select min(key2) from t2 where key2 >= 1.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select max(key1), min(key2) from t1, t2 where key1 <= 0.6158 and key2 >= 1.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range key1 key1 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 3 Using where; Using index explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range key1 key1 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 3 Using where; Using index select max(key1) from t1 where key1 <= 0.6158; max(key1) 0.6158 @@ -2923,13 +2923,13 @@ a 2 4 EXPLAIN SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where -1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.a 3 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 5 test.t1.a 3 Using where; Using join buffer (flat, BNLH join) EXPLAIN SELECT t1.a FROM t1 INNER JOIN t2 ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t2.a 5 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t1 NULL hash_ALL NULL #hash#$hj 5 test.t2.a 5 Using where; Using join buffer (flat, BNLH join) DROP TABLE t1,t2; select x'3136' + 0, X'3136' + 0, b'10' + 0, B'10' + 0; x'3136' + 0 X'3136' + 0 b'10' + 0 B'10' + 0 @@ -3362,10 +3362,10 @@ EXPLAIN SELECT t2.key_a,foo FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a INNER JOIN t3 ON t1.key_a = t3.key_a WHERE t2.key_a=2 and key_b=5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 8 const,const 1 SELECT t2.key_a,foo FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a INNER JOIN t3 ON t1.key_a = t3.key_a @@ -3376,10 +3376,10 @@ EXPLAIN SELECT t2.key_a,foo FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a INNER JOIN t3 ON t1.key_a = t3.key_a WHERE t2.key_a=2 and key_b=5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 8 const,const 1 DROP TABLE t1,t2,t3; create table t1 (f1 int); insert into t1 values(1),(2); @@ -3430,9 +3430,9 @@ sku sppr name sku pr EXPLAIN SELECT t2.sku, t2.sppr, t2.name, t1.sku, t1.pr FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 Using index condition; Rowid-ordered scan DROP TABLE t1,t2; SET SQL_MODE='NO_UNSIGNED_SUBTRACTION'; CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL); @@ -3470,9 +3470,9 @@ Z In next EXPLAIN, B.rows must be exactly 10: explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5 and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A range PRIMARY PRIMARY 12 NULL 4 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 10 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL range PRIMARY PRIMARY 12 NULL 4 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE B NULL ref PRIMARY PRIMARY 8 const,test.A.e 10 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan drop table t1, t2; CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b)); INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2), @@ -3484,14 +3484,14 @@ INSERT INTO t2 VALUES (0,0,0), (0,0,1), (8,0,0), (8,0,1), (9,0,0), (9,0,1); EXPLAIN SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where -1 SIMPLE t1 eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL c NULL NULL NULL 18 Using where +1 SIMPLE t1 NULL eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter EXPLAIN SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where -1 SIMPLE t1 eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL c NULL NULL NULL 18 Using where +1 SIMPLE t1 NULL eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter DROP TABLE t1, t2; create table t1 ( a int unsigned not null auto_increment primary key, @@ -3531,13 +3531,13 @@ INSERT INTO t2 VALUES (3), (3), (4); EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 ref idx idx 4 const 8 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL ref idx idx 4 const 8 Using index EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 ref idx idx 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL ref idx idx 4 const 1 Using index DROP TABLE t1, t2; CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a int); INSERT INTO t1 VALUES (1,2), (2,NULL), (3,2); @@ -3548,10 +3548,10 @@ INSERT INTO t3 VALUES (2,10), (2,20), (1,30), (2,40), (2,50), (1,60), (3,70), (1 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id WHERE t1.id=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 const idx1 NULL NULL NULL 1 -1 SIMPLE t3 ref idx1 idx1 5 const 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL const idx1 NULL NULL NULL 1 +1 SIMPLE t3 NULL ref idx1 idx1 5 const 4 SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id WHERE t1.id=2; id a b c d e @@ -3579,21 +3579,21 @@ INSERT INTO t2 VALUES EXPLAIN SELECT t2.* FROM t1 JOIN t2 ON t2.fk=t1.pk WHERE t2.fk < 'c' AND t2.pk=t1.fk; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan EXPLAIN SELECT t2.* FROM t1 JOIN t2 ON t2.fk=t1.pk WHERE t2.fk BETWEEN 'a' AND 'b' AND t2.pk=t1.fk; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan EXPLAIN SELECT t2.* FROM t1 JOIN t2 ON t2.fk=t1.pk WHERE t2.fk IN ('a','b') AND t2.pk=t1.fk; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan DROP TABLE t1,t2; CREATE TABLE t1 (a int, b varchar(20) NOT NULL, PRIMARY KEY(a)); CREATE TABLE t2 (a int, b varchar(20) NOT NULL, @@ -3601,8 +3601,8 @@ PRIMARY KEY (a), UNIQUE KEY (b)); INSERT INTO t1 VALUES (1,'a'),(2,'b'),(3,'c'); INSERT INTO t2 VALUES (1,'a'),(2,'b'),(3,'c'); EXPLAIN SELECT t1.a FROM t1 LEFT JOIN t2 ON t2.b=t1.b WHERE t1.a=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 DROP TABLE t1,t2; CREATE TABLE t1(id int PRIMARY KEY, b int, e int); CREATE TABLE t2(i int, a int, INDEX si(i), INDEX ai(a)); @@ -3624,34 +3624,34 @@ EXPLAIN SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3 WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND t3.a=t2.a AND t3.c IN ('bb','ee'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range si si 5 NULL 4 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter EXPLAIN SELECT t3.a FROM t1,t2,t3 WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND t3.a=t2.a AND t3.c IN ('bb','ee') ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range si,ai si 5 NULL 4 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter EXPLAIN SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3 WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND t3.c IN ('bb','ee'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si si 5 NULL 2 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range si si 5 NULL 2 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter EXPLAIN SELECT t3.a FROM t1,t2,t3 WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND t3.c IN ('bb','ee'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si,ai si 5 NULL 2 Using index condition; Using where; Rowid-ordered scan -1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range si,ai si 5 NULL 2 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter DROP TABLE t1,t2,t3; CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int); CREATE TABLE t2 ( f11 int PRIMARY KEY ); @@ -3686,13 +3686,13 @@ SELECT COUNT(*) FROM t1 WHERE ID_better=1; COUNT(*) 2 EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 Using where DROP INDEX idx1 ON t1; CREATE UNIQUE INDEX idx1 ON t1(ID_with_null); EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 Using where DROP TABLE t1; CREATE TABLE t1 ( ID1_with_null int NULL, @@ -3727,35 +3727,35 @@ COUNT(*) 2 EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (6%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (6%) Using where; Using rowid filter EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null=3 IS NULL ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where DROP INDEX idx1 ON t1; CREATE UNIQUE INDEX idx1 ON t1(ID1_with_null,ID2_with_null); EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (7%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (7%) Using where; Using rowid filter EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null IS NULL ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND (ID2_with_null=1 OR ID2_with_null=2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter idx1,idx2 idx1|idx2 5|4 const 2 (1%) Using index condition; Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx1|idx2 5|4 const 2 (1%) Using index condition; Using where; Using rowid filter DROP TABLE t1; CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY ts(ts)); INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00"); @@ -3774,9 +3774,9 @@ EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30 AND t1.ts BETWEEN t2.dt1 AND t2.dt2 AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t1 range ts ts 4 NULL 2 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t1 NULL range ts ts 4 NULL 2 Using index condition; Using where; Rowid-ordered scan SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30 AND t1.ts BETWEEN t2.dt1 AND t2.dt2 AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31"; @@ -3859,16 +3859,16 @@ cc 3 7 cc 2 5 cc 5 3 EXPLAIN SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref name name 6 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref name name 6 const 4 Using where SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; name LENGTH(name) n cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range name name 6 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 Using where SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%'; name LENGTH(name) n cc 5 3 @@ -3876,8 +3876,8 @@ cc 4 4 cc 2 5 cc 3 7 EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range name name 6 NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 Using where; Using filesort SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name; name LENGTH(name) n cc 4 4 @@ -3885,9 +3885,9 @@ cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref name name 6 test.t1.name 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref name name 6 test.t1.name 2 Using where SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; name name n ccc NULL NULL @@ -3952,16 +3952,16 @@ cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref name name 6 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref name name 6 const 4 Using where SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; name LENGTH(name) n cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range name name 6 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 Using where SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%'; name LENGTH(name) n cc 5 3 @@ -3969,8 +3969,8 @@ cc 4 4 cc 2 5 cc 3 7 EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range name name 6 NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 Using where; Using filesort SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name; name LENGTH(name) n cc 4 4 @@ -3978,9 +3978,9 @@ cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref name name 6 test.t1.name 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref name name 6 test.t1.name 2 Using where SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; name name n ccc NULL NULL @@ -4041,17 +4041,17 @@ INSERT INTO t1 VALUES (1,1), (1,2), (1,3), (1,4), (1,5), (1, 6), (1,7); EXPLAIN SELECT COUNT(*) FROM t1 f1 INNER JOIN t1 f2 ON ( f1.b=f2.b AND f1.a<f2.a ) WHERE 1 AND f1.b NOT IN (100,2232,3343,51111); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE f1 range inx inx 5 NULL 7 Using where; Using index -1 SIMPLE f2 ref inx inx 5 test.f1.b 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE f1 NULL range inx inx 5 NULL 7 Using where; Using index +1 SIMPLE f2 NULL ref inx inx 5 test.f1.b 1 Using where; Using index DROP TABLE t1; CREATE TABLE t1 (c1 INT, c2 INT); INSERT INTO t1 VALUES (1,11), (2,22), (2,22); EXPLAIN SELECT c1 FROM t1 WHERE (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT COUNT(c2)))))))))))))))))))))))))))))))) > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -31 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -32 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +31 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +32 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used EXPLAIN SELECT c1 FROM t1 WHERE (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT COUNT(c2))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) > 0; ERROR HY000: Too high level of nesting for select DROP TABLE t1; @@ -4104,8 +4104,8 @@ join_2.c1, join_7.c1, join_1.c1, join_0.c1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select NULL AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by NULL,NULL,NULL,NULL,NULL SHOW WARNINGS; @@ -4447,13 +4447,13 @@ drop table t1, t2, t3; CREATE TABLE t1 (a INT KEY, b INT); INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4); EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where; Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2 EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where; Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2 DROP TABLE t1; @@ -4466,9 +4466,9 @@ INSERT INTO t1 VALUES (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')), (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')); EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 hash_ALL a #hash#$hj 6 test.t1.a 2 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL hash_ALL a #hash#$hj 6 test.t1.a 2 Using where; Using join buffer (flat, BNLH join) SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2; 1 1 @@ -4476,9 +4476,9 @@ SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2; 1 1 EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 hash_ALL a #hash#$hj 6 test.t1.a 2 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL hash_ALL a #hash#$hj 6 test.t1.a 2 Using where; Using join buffer (flat, BNLH join) SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a); 1 1 @@ -4522,8 +4522,8 @@ SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; a 2001-01-01 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a` from dual where 1 DROP TABLE t1; @@ -4533,8 +4533,8 @@ SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; a 2001-01-01 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01' AS `a` from dual where 1 DROP TABLE t1; @@ -4544,8 +4544,8 @@ SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; a 2001-01-01 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a` from dual where 1 DROP TABLE t1; @@ -4555,8 +4555,8 @@ SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; a b 2001-01-01 00:00:00 2001-01-01 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 1 DROP TABLE t1; @@ -4565,16 +4565,16 @@ INSERT INTO t1 VALUES('2001-01-01', '2001-01-01'); SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; a b EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 0 SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01'; a b 2001-01-01 00:00:00 2001-01-01 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 1 DROP TABLE t1; @@ -4590,10 +4590,10 @@ EXPLAIN EXTENDED SELECT x.a, y.a, z.a FROM t1 x JOIN t1 y ON x.a=y.a JOIN t1 z ON y.a=z.a WHERE x.a='2001-01-01' AND z.a='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x system NULL NULL NULL NULL 1 100.00 -1 SIMPLE y system NULL NULL NULL NULL 1 100.00 -1 SIMPLE z system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE x NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE y NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE z NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a` from dual where 1 DROP TABLE t1; @@ -4609,8 +4609,8 @@ INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12; INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12; INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12; EXPLAIN SELECT a FROM t1 ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 SELECT a FROM t1 ORDER BY a; DROP TABLE t1; CREATE TABLE t1(a CHAR(0) NOT NULL, b CHAR(0) NOT NULL, c int); @@ -4619,8 +4619,8 @@ INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12; INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12; INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12; EXPLAIN SELECT a FROM t1 ORDER BY a LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 SELECT a FROM t1 ORDER BY a LIMIT 5; a @@ -4629,8 +4629,8 @@ a EXPLAIN SELECT * FROM t1 ORDER BY a, b LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 SELECT * FROM t1 ORDER BY a, b LIMIT 5; a b c 0 @@ -4639,8 +4639,8 @@ a b c 0 2 EXPLAIN SELECT * FROM t1 ORDER BY a, b, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 Using filesort SELECT * FROM t1 ORDER BY a, b, c LIMIT 5; a b c 0 @@ -4649,8 +4649,8 @@ a b c 0 0 EXPLAIN SELECT * FROM t1 ORDER BY c, a LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 Using filesort SELECT * FROM t1 ORDER BY c, a LIMIT 5; a b c 0 @@ -4706,8 +4706,8 @@ DROP TABLE t1,t2; CREATE TABLE t1 (a INT NOT NULL, b INT); INSERT INTO t1 VALUES (1, 1); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select 1 AS `a`,1 AS `b` from dual where 1 SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; @@ -4716,18 +4716,18 @@ a b DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 DROP TABLE t1; @@ -4821,39 +4821,39 @@ SELECT * FROM t1 WHERE a = 1 + 1; a 2 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = <cache>(1 + 1) SELECT * FROM t1 HAVING a = 1 + 1; a 2 EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having `test`.`t1`.`a` = <cache>(1 + 1) SELECT * FROM t1, t2 WHERE a = b + (1 + 1); a b 4 2 EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a = b + (1 + 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where `test`.`t1`.`a` = <cache>(2 + (1 + 1)) SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1; b a 2 3 EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select 2 AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > <cache>(unix_timestamp('2009-03-10 00:00:00')) CREATE FUNCTION f1() RETURNS INT DETERMINISTIC @@ -4869,8 +4869,8 @@ SELECT @cnt; @cnt 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = f1(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = <cache>(`f1`()) DROP TABLE t1, t2; @@ -4926,8 +4926,8 @@ DROP TABLE t1; CREATE TABLE t1(a ENUM('') NOT NULL); INSERT INTO t1 VALUES (), (), (); EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using filesort SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; 1 1 @@ -4954,13 +4954,13 @@ INSERT INTO t6 VALUES (9),(7); SET @save_join_buffer_size=@@join_buffer_size,@@join_buffer_size = 2176; EXPLAIN SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 12 -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.f1 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t5 ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 4 test.t1.f1 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join) SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; f1 f1 f1 f1 f2 f1 f1 3 9 NULL NULL NULL 20 9 @@ -5037,20 +5037,20 @@ INSERT INTO t3 VALUES set @tmp= @@optimizer_switch; SET SESSION optimizer_switch='index_condition_pushdown=off'; EXPLAIN SELECT * from t1,t2,t3 WHERE t3.a3=t1.a1 AND t2.a2=t1.a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL idx NULL NULL NULL 3 -1 SIMPLE t2 ref idx idx 4 test.t1.a1 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t3 ref idx idx 4 test.t1.a1 5 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.a2=t1.a1 AND t3.a3=t1.a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL idx NULL NULL NULL 3 -1 SIMPLE t2 ref idx idx 4 test.t1.a1 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t3 ref idx idx 4 test.t1.a1 5 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.a2=t1.a1 AND t3.a3=t2.a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL idx NULL NULL NULL 3 -1 SIMPLE t2 ref idx idx 4 test.t1.a1 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t3 ref idx idx 4 test.t1.a1 5 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT * from t1,t2,t3 WHERE t3.a3=t1.a1 AND t2.a2=t1.a1 AND LENGTH(CONCAT(CONCAT(t1.b1,t2.b2),t3.b3)) <= 7; @@ -5140,14 +5140,14 @@ LEFT JOIN (((t4 JOIN t5 ON t4.f42=t5.f51) LEFT JOIN t6 ON t6.f62>0) JOIN t7 ON t6.f61>0) ON t3.f31 = t6.f61 WHERE t7.f71>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system PRIMARY,f32 NULL NULL NULL 1 -1 SIMPLE t5 system PRIMARY NULL NULL NULL 1 -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 ref f22 f22 5 const 1 -1 SIMPLE t4 ref f42 f42 5 const 1 Using index -1 SIMPLE t6 ref f61 f61 5 const 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL system PRIMARY,f32 NULL NULL NULL 1 +1 SIMPLE t5 NULL system PRIMARY NULL NULL NULL 1 +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL ref f22 f22 5 const 1 +1 SIMPLE t4 NULL ref f42 f42 5 const 1 Using index +1 SIMPLE t6 NULL ref f61 f61 5 const 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) SELECT t2.f23 FROM (t1 LEFT JOIN (t2 JOIN t3 ON t2.f22=t3.f32) ON t1.f11=t3.f31) LEFT JOIN @@ -5201,8 +5201,8 @@ LEFT OUTER JOIN (t2 INNER JOIN t_empty ON TRUE) ON t1.pk=t2.pk WHERE t2.pk <> 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 @@ -5219,8 +5219,8 @@ LEFT OUTER JOIN (t2 CROSS JOIN t_empty) ON t1.pk=t2.pk WHERE t2.pk <> 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 @@ -5237,8 +5237,8 @@ LEFT OUTER JOIN (t2 INNER JOIN t_empty ON t_empty.i=t2.i) ON t1.pk=t2.pk WHERE t2.pk <> 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 @@ -5267,8 +5267,8 @@ INSERT INTO `CC` VALUES ,'x'); EXPLAIN SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4 HAVING G1 ORDER BY `varchar_key` LIMIT 6 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CC range int_key int_key 4 NULL 9 Using index condition; Using where; Rowid-ordered scan; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE CC NULL range int_key int_key 4 NULL 9 Using index condition; Using where; Rowid-ordered scan; Using filesort SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4 HAVING G1 ORDER BY `varchar_key` LIMIT 6 ; G1 @@ -5290,8 +5290,8 @@ a b 2 2 EXPLAIN SELECT * FROM t1 WHERE a = b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 DROP TABLE t1; # # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on @@ -5412,8 +5412,8 @@ SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0; pk a EXPLAIN EXTENDED SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 2 AS `pk`,0 AS `a` from `test`.`t1` where 0 DROP TABLE t1; @@ -5434,9 +5434,9 @@ INSERT INTO t2 VALUES (8), (9); EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON ( c = a ) WHERE 1 IS NULL OR b < 33 AND b = c; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system idx NULL NULL NULL 1 100.00 -1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system idx NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL ref idx idx 5 const 1 100.00 Using index Warnings: Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` = 8 SELECT * FROM t1 INNER JOIN t2 ON ( c = a ) @@ -5465,8 +5465,8 @@ CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,101),(2,102),(3,103),(4,104),(5,11); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1); @@ -5474,8 +5474,8 @@ a b 5 11 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5); @@ -5483,8 +5483,8 @@ a b 5 11 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1); @@ -5492,16 +5492,16 @@ a b 5 11 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (b = 1 OR a = 1) AND (b = 5 AND a = 5 OR 1 != 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where 0 SELECT * FROM t1 WHERE (b = 1 OR a = 1) AND (b = 5 AND a = 5 OR 1 != 1); a b EXPLAIN EXTENDED SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 5 and `test`.`t1`.`a` = 5 SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1); @@ -5517,9 +5517,9 @@ CREATE TABLE t2 (c varchar(1), d varchar(1)) ENGINE=MyISAM; INSERT INTO t2 VALUES ('k','k'); EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where `test`.`t1`.`b` = 'k' and `test`.`t1`.`a` = 136 SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b)); @@ -5536,8 +5536,8 @@ INSERT INTO t2 VALUES (8), (9); EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0 SELECT * FROM t1, t2 @@ -5558,9 +5558,9 @@ pk1 a1 b1 pk2 a2 EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a1 = pk2 AND ( ( b1 = 6 OR a2 > 4 ) AND pk2 = a2 OR pk1 IS NULL ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system PRIMARY NULL NULL NULL 1 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where `test`.`t1`.`a1` = 1 and `test`.`t1`.`b1` = 6 INSERT INTO t1 VALUES (3,1,6); diff --git a/mysql-test/main/select_pkeycache.result b/mysql-test/main/select_pkeycache.result index 2f051ab33bf..3004c3c941a 100644 --- a/mysql-test/main/select_pkeycache.result +++ b/mysql-test/main/select_pkeycache.result @@ -131,20 +131,20 @@ fld3 select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%'; fld3 explain select t2.fld3 from t2 where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3,not_used); ERROR 42000: Key 'not_used' doesn't exist in table 't2' explain select fld3 from t2 use index (not_used); @@ -154,8 +154,8 @@ fld3 honeysuckle honoring explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld3 fld3 30 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 Using where; Using index select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3; fld1 fld3 148504 Colombo @@ -174,8 +174,8 @@ fld1 250501 250502 explain select fld1 from t2 where fld1=250501 or fld1="250502"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld1 fld1 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 Using where; Using index select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502; fld1 250501 @@ -183,8 +183,8 @@ fld1 250505 250601 explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 Using where; Using index select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; fld1 fld3 012001 flanking @@ -600,21 +600,21 @@ companynr rtrim(space(512+companynr)) select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3; fld3 explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort -1 SIMPLE t3 ref period period 4 test.t1.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index period period 4 NULL 1 -1 SIMPLE t1 ref period period 4 test.t3.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL index period period 4 NULL 1 +1 SIMPLE t1 NULL ref period period 4 test.t3.period 4181 explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index period period 4 NULL 1 -1 SIMPLE t3 ref period period 4 test.t1.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index period period 4 NULL 1 +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 select period from t1; period 9410 @@ -627,9 +627,9 @@ select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3. fld3 period breaking 1001 explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const fld1 fld1 4 const 1 -1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const fld1 fld1 4 const 1 +1 SIMPLE t3 NULL const PRIMARY,period PRIMARY 4 const 1 select fld3,period from t2,t1 where companynr*10 = 37*10; fld3 period breaking 9410 @@ -1359,81 +1359,81 @@ select count(*) from t2 left join t4 using (companynr) where t4.companynr is not count(*) 1199 explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 Using where; Not exists select companynr,companyname from t2 left join t4 using (companynr) where companynr is null; companynr companyname select count(*) from t2 left join t4 using (companynr) where companynr is not null; count(*) 1200 explain select companynr,companyname from t2 left join t4 using (companynr) where companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE delete from t2 where fld1=999999; explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; companynr companynr 37 36 41 40 explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL index NULL PRIMARY 1 NULL 12 Using index; Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join) select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008; fld1 companynr fld3 period 038008 37 reporters 1008 @@ -1506,8 +1506,8 @@ select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069 explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>""; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; @@ -1947,11 +1947,11 @@ select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = fld1 sum(price) 038008 234298 explain select fld3 from t2 where 1>2 or 2>3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select fld3 from t2 where fld1=fld1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502; companynr fld1 34 250501 @@ -2002,8 +2002,8 @@ select count(*) from t3 where companynr=512 and price2=76234234; count(*) 4181 explain select min(fld1),max(fld1),count(*) from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(fld1),max(fld1),count(*) from t2; min(fld1) max(fld1) count(*) 0 1232609 1199 @@ -2328,11 +2328,11 @@ insert into t2 values (1); insert into t4 values (1,1); explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE t4 const id4 NULL NULL NULL 1 -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t4 NULL const id4 NULL NULL NULL 1 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 Using where select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; id1 id2 id3 id4 id44 @@ -2363,17 +2363,17 @@ create table t2 (c integer, d integer, index(c), index(d)); insert into t1 values (1,2), (2,2), (3,2), (4,2); insert into t2 values (1,3), (2,3), (3,4), (4,4); explain select * from t1 left join t2 on a=c where d in (4); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref c,d d 5 const 2 -1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref c,d d 5 const 2 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) select * from t1 left join t2 on a=c where d in (4); a b c d 3 2 3 4 4 2 4 4 explain select * from t1 left join t2 on a=c where d = 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref c,d d 5 const 2 -1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref c,d d 5 const 2 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) select * from t1 left join t2 on a=c where d = 4; a b c d 3 2 3 4 @@ -2389,8 +2389,8 @@ INSERT INTO t1 VALUES (1,'a'); INSERT INTO t1 VALUES (2,'b'); INSERT INTO t1 VALUES (3,'c'); EXPLAIN SELECT i FROM t1 WHERE i=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index DROP TABLE t1; CREATE TABLE t1 ( a BLOB, INDEX (a(20)) ); CREATE TABLE t2 ( a BLOB, INDEX (a(20)) ); @@ -2398,13 +2398,13 @@ INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five'); INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five'); EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref a a 23 test.t1.a 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref a a 23 test.t1.a 2 Using where EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref a a 23 test.t1.a 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref a a 23 test.t1.a 2 Using where DROP TABLE t1, t2; CREATE TABLE t1 ( city char(30) ); INSERT INTO t1 VALUES ('London'); @@ -2416,14 +2416,14 @@ SELECT * FROM t1 WHERE city='london'; city London EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE city='London' AND city='london'; city London EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; city London @@ -2581,8 +2581,8 @@ create table t2 (a tinyint unsigned); create index t2i on t2(a); insert into t2 values (0), (254), (255); explain select * from t2 where a > -1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index t2i t2i 2 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index t2i t2i 2 NULL 3 Using where; Using index select * from t2 where a > -1; a 0 @@ -2719,16 +2719,16 @@ insert into t3 values (1,1),(1,2); explain select straight_join DISTINCT t2.a,t2.b, t1.c from t1, t3, t2 where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and t2.b like '%%' order by t2.b limit 0,1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref b,c b 5 const 1 Using temporary; Using filesort -1 SIMPLE t3 index PRIMARY,a,b PRIMARY 8 NULL 2 Using index; Using join buffer (flat, BNL join) -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref b,c b 5 const 1 Using temporary; Using filesort +1 SIMPLE t3 NULL index PRIMARY,a,b PRIMARY 8 NULL 2 Using index; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) DROP TABLE t1,t2,t3; CREATE TABLE t1 (a int, INDEX idx(a)); INSERT INTO t1 VALUES (2), (3), (1); EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 EXPLAIN SELECT * FROM t1 IGNORE INDEX (a); ERROR 42000: Key 'a' doesn't exist in table 't1' EXPLAIN SELECT * FROM t1 FORCE INDEX (a); @@ -2740,9 +2740,9 @@ CREATE TABLE t2 (a int PRIMARY KEY, b int, KEY b (b)); INSERT INTO t2 VALUES (1,NULL), (2,10); ALTER TABLE t1 ENABLE KEYS; EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b b 5 NULL 2 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index b b 5 NULL 2 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; a b a b 1 NULL 1 1 @@ -2750,9 +2750,9 @@ a b a b 1 NULL 4 10 2 10 4 10 EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index b b 5 NULL 2 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index b b 5 NULL 2 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL; a b a b 1 NULL 1 1 @@ -2765,27 +2765,27 @@ CREATE TABLE t2 (key2 float default NULL, UNIQUE KEY key2 (key2)); INSERT INTO t1 VALUES (0.3762),(0.3845),(0.6158),(0.7941); INSERT INTO t2 VALUES (1.3762),(1.3845),(1.6158),(1.7941); explain select max(key1) from t1 where key1 <= 0.6158; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select max(key2) from t2 where key2 <= 1.6158; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select min(key1) from t1 where key1 >= 0.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select min(key2) from t2 where key2 >= 1.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select max(key1), min(key2) from t1, t2 where key1 <= 0.6158 and key2 >= 1.3762; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range key1 key1 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 3 Using where; Using index explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range key1 key1 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 3 Using where; Using index select max(key1) from t1 where key1 <= 0.6158; max(key1) 0.6158 @@ -2912,13 +2912,13 @@ a 2 4 EXPLAIN SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) EXPLAIN SELECT t1.a FROM t1 INNER JOIN t2 ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) DROP TABLE t1,t2; select x'3136' + 0, X'3136' + 0, b'10' + 0, B'10' + 0; x'3136' + 0 X'3136' + 0 b'10' + 0 B'10' + 0 @@ -3351,10 +3351,10 @@ EXPLAIN SELECT t2.key_a,foo FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a INNER JOIN t3 ON t1.key_a = t3.key_a WHERE t2.key_a=2 and key_b=5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 8 const,const 1 SELECT t2.key_a,foo FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a INNER JOIN t3 ON t1.key_a = t3.key_a @@ -3365,10 +3365,10 @@ EXPLAIN SELECT t2.key_a,foo FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a INNER JOIN t3 ON t1.key_a = t3.key_a WHERE t2.key_a=2 and key_b=5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 8 const,const 1 DROP TABLE t1,t2,t3; create table t1 (f1 int); insert into t1 values(1),(2); @@ -3419,9 +3419,9 @@ sku sppr name sku pr EXPLAIN SELECT t2.sku, t2.sppr, t2.name, t1.sku, t1.pr FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 Using index condition DROP TABLE t1,t2; SET SQL_MODE='NO_UNSIGNED_SUBTRACTION'; CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL); @@ -3459,9 +3459,9 @@ Z In next EXPLAIN, B.rows must be exactly 10: explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5 and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A range PRIMARY PRIMARY 12 NULL 4 Using index condition; Using where -1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL range PRIMARY PRIMARY 12 NULL 4 Using index condition; Using where +1 SIMPLE B NULL ref PRIMARY PRIMARY 8 const,test.A.e 10 drop table t1, t2; CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b)); INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2), @@ -3473,14 +3473,14 @@ INSERT INTO t2 VALUES (0,0,0), (0,0,1), (8,0,0), (8,0,1), (9,0,0), (9,0,1); EXPLAIN SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where -1 SIMPLE t1 eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL c NULL NULL NULL 18 Using where +1 SIMPLE t1 NULL eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using rowid filter EXPLAIN SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where -1 SIMPLE t1 eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL c NULL NULL NULL 18 Using where +1 SIMPLE t1 NULL eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) Using where; Using rowid filter DROP TABLE t1, t2; create table t1 ( a int unsigned not null auto_increment primary key, @@ -3520,13 +3520,13 @@ INSERT INTO t2 VALUES (3), (3), (4); EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 ref idx idx 4 const 8 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL ref idx idx 4 const 8 Using index EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 ref idx idx 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL ref idx idx 4 const 1 Using index DROP TABLE t1, t2; CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a int); INSERT INTO t1 VALUES (1,2), (2,NULL), (3,2); @@ -3537,10 +3537,10 @@ INSERT INTO t3 VALUES (2,10), (2,20), (1,30), (2,40), (2,50), (1,60), (3,70), (1 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id WHERE t1.id=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 const idx1 NULL NULL NULL 1 -1 SIMPLE t3 ref idx1 idx1 5 const 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL const idx1 NULL NULL NULL 1 +1 SIMPLE t3 NULL ref idx1 idx1 5 const 4 SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id WHERE t1.id=2; id a b c d e @@ -3568,21 +3568,21 @@ INSERT INTO t2 VALUES EXPLAIN SELECT t2.* FROM t1 JOIN t2 ON t2.fk=t1.pk WHERE t2.fk < 'c' AND t2.pk=t1.fk; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where EXPLAIN SELECT t2.* FROM t1 JOIN t2 ON t2.fk=t1.pk WHERE t2.fk BETWEEN 'a' AND 'b' AND t2.pk=t1.fk; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where EXPLAIN SELECT t2.* FROM t1 JOIN t2 ON t2.fk=t1.pk WHERE t2.fk IN ('a','b') AND t2.pk=t1.fk; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 Using index condition; Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 Using where DROP TABLE t1,t2; CREATE TABLE t1 (a int, b varchar(20) NOT NULL, PRIMARY KEY(a)); CREATE TABLE t2 (a int, b varchar(20) NOT NULL, @@ -3590,8 +3590,8 @@ PRIMARY KEY (a), UNIQUE KEY (b)); INSERT INTO t1 VALUES (1,'a'),(2,'b'),(3,'c'); INSERT INTO t2 VALUES (1,'a'),(2,'b'),(3,'c'); EXPLAIN SELECT t1.a FROM t1 LEFT JOIN t2 ON t2.b=t1.b WHERE t1.a=3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 DROP TABLE t1,t2; CREATE TABLE t1(id int PRIMARY KEY, b int, e int); CREATE TABLE t2(i int, a int, INDEX si(i), INDEX ai(a)); @@ -3613,34 +3613,34 @@ EXPLAIN SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3 WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND t3.a=t2.a AND t3.c IN ('bb','ee'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using where -1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range si si 5 NULL 4 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter EXPLAIN SELECT t3.a FROM t1,t2,t3 WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND t3.a=t2.a AND t3.c IN ('bb','ee') ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using where -1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range si,ai si 5 NULL 4 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter EXPLAIN SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3 WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND t3.c IN ('bb','ee'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si si 5 NULL 2 Using index condition; Using where -1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range si si 5 NULL 2 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter EXPLAIN SELECT t3.a FROM t1,t2,t3 WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND t3.c IN ('bb','ee'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t2 range si,ai si 5 NULL 2 Using index condition; Using where -1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 NULL range si,ai si 5 NULL 2 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter DROP TABLE t1,t2,t3; CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int); CREATE TABLE t2 ( f11 int PRIMARY KEY ); @@ -3675,13 +3675,13 @@ SELECT COUNT(*) FROM t1 WHERE ID_better=1; COUNT(*) 2 EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 Using where DROP INDEX idx1 ON t1; CREATE UNIQUE INDEX idx1 ON t1(ID_with_null); EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 Using where DROP TABLE t1; CREATE TABLE t1 ( ID1_with_null int NULL, @@ -3716,35 +3716,35 @@ COUNT(*) 2 EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (6%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (6%) Using where; Using rowid filter EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null=3 IS NULL ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where DROP INDEX idx1 ON t1; CREATE UNIQUE INDEX idx1 ON t1(ID1_with_null,ID2_with_null); EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (7%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (7%) Using where; Using rowid filter EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null IS NULL ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID1_with_null IS NULL AND (ID2_with_null=1 OR ID2_with_null=2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref|filter idx1,idx2 idx1|idx2 5|4 const 2 (1%) Using index condition; Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx1|idx2 5|4 const 2 (1%) Using index condition; Using where; Using rowid filter DROP TABLE t1; CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY ts(ts)); INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00"); @@ -3763,9 +3763,9 @@ EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30 AND t1.ts BETWEEN t2.dt1 AND t2.dt2 AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 -1 SIMPLE t1 range ts ts 4 NULL 2 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t1 NULL range ts ts 4 NULL 2 Using index condition; Using where SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30 AND t1.ts BETWEEN t2.dt1 AND t2.dt2 AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31"; @@ -3848,16 +3848,16 @@ cc 3 7 cc 2 5 cc 5 3 EXPLAIN SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref name name 6 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref name name 6 const 4 Using where SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; name LENGTH(name) n cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range name name 6 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 Using where SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%'; name LENGTH(name) n cc 5 3 @@ -3865,8 +3865,8 @@ cc 4 4 cc 2 5 cc 3 7 EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range name name 6 NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 Using where; Using filesort SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name; name LENGTH(name) n cc 4 4 @@ -3874,9 +3874,9 @@ cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref name name 6 test.t1.name 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref name name 6 test.t1.name 2 Using where SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; name name n ccc NULL NULL @@ -3941,16 +3941,16 @@ cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref name name 6 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref name name 6 const 4 Using where SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; name LENGTH(name) n cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range name name 6 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 Using where SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%'; name LENGTH(name) n cc 5 3 @@ -3958,8 +3958,8 @@ cc 4 4 cc 2 5 cc 3 7 EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range name name 6 NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 Using where; Using filesort SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name; name LENGTH(name) n cc 4 4 @@ -3967,9 +3967,9 @@ cc 5 3 cc 2 5 cc 3 7 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 -1 SIMPLE t2 ref name name 6 test.t1.name 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 NULL ref name name 6 test.t1.name 2 Using where SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name; name name n ccc NULL NULL @@ -4030,17 +4030,17 @@ INSERT INTO t1 VALUES (1,1), (1,2), (1,3), (1,4), (1,5), (1, 6), (1,7); EXPLAIN SELECT COUNT(*) FROM t1 f1 INNER JOIN t1 f2 ON ( f1.b=f2.b AND f1.a<f2.a ) WHERE 1 AND f1.b NOT IN (100,2232,3343,51111); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE f1 range inx inx 5 NULL 7 Using where; Using index -1 SIMPLE f2 ref inx inx 5 test.f1.b 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE f1 NULL range inx inx 5 NULL 7 Using where; Using index +1 SIMPLE f2 NULL ref inx inx 5 test.f1.b 1 Using where; Using index DROP TABLE t1; CREATE TABLE t1 (c1 INT, c2 INT); INSERT INTO t1 VALUES (1,11), (2,22), (2,22); EXPLAIN SELECT c1 FROM t1 WHERE (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT COUNT(c2)))))))))))))))))))))))))))))))) > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -31 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -32 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +31 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +32 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used EXPLAIN SELECT c1 FROM t1 WHERE (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT COUNT(c2))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) > 0; ERROR HY000: Too high level of nesting for select DROP TABLE t1; @@ -4093,8 +4093,8 @@ join_2.c1, join_7.c1, join_1.c1, join_0.c1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select NULL AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by NULL,NULL,NULL,NULL,NULL SHOW WARNINGS; @@ -4436,13 +4436,13 @@ drop table t1, t2, t3; CREATE TABLE t1 (a INT KEY, b INT); INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4); EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2 EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 100.00 Using index condition; Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` > 1 limit 2 DROP TABLE t1; @@ -4455,9 +4455,9 @@ INSERT INTO t1 VALUES (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')), (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')); EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1) SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2; 1 1 @@ -4465,9 +4465,9 @@ SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2; 1 1 EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1) SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a); 1 1 @@ -4511,8 +4511,8 @@ SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; a 2001-01-01 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a` from dual where 1 DROP TABLE t1; @@ -4522,8 +4522,8 @@ SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; a 2001-01-01 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01' AS `a` from dual where 1 DROP TABLE t1; @@ -4533,8 +4533,8 @@ SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; a 2001-01-01 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a` from dual where 1 DROP TABLE t1; @@ -4544,8 +4544,8 @@ SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; a b 2001-01-01 00:00:00 2001-01-01 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 1 DROP TABLE t1; @@ -4554,16 +4554,16 @@ INSERT INTO t1 VALUES('2001-01-01', '2001-01-01'); SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; a b EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 0 SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01'; a b 2001-01-01 00:00:00 2001-01-01 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01' AS `b` from dual where 1 DROP TABLE t1; @@ -4579,10 +4579,10 @@ EXPLAIN EXTENDED SELECT x.a, y.a, z.a FROM t1 x JOIN t1 y ON x.a=y.a JOIN t1 z ON y.a=z.a WHERE x.a='2001-01-01' AND z.a='2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE x system NULL NULL NULL NULL 1 100.00 -1 SIMPLE y system NULL NULL NULL NULL 1 100.00 -1 SIMPLE z system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE x NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE y NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE z NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select '2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a`,'2001-01-01 00:00:00' AS `a` from dual where 1 DROP TABLE t1; @@ -4598,8 +4598,8 @@ INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12; INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12; INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12; EXPLAIN SELECT a FROM t1 ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 SELECT a FROM t1 ORDER BY a; DROP TABLE t1; CREATE TABLE t1(a CHAR(0) NOT NULL, b CHAR(0) NOT NULL, c int); @@ -4608,8 +4608,8 @@ INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12; INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12; INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12; EXPLAIN SELECT a FROM t1 ORDER BY a LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 SELECT a FROM t1 ORDER BY a LIMIT 5; a @@ -4618,8 +4618,8 @@ a EXPLAIN SELECT * FROM t1 ORDER BY a, b LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 SELECT * FROM t1 ORDER BY a, b LIMIT 5; a b c 0 @@ -4628,8 +4628,8 @@ a b c 0 2 EXPLAIN SELECT * FROM t1 ORDER BY a, b, c LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 Using filesort SELECT * FROM t1 ORDER BY a, b, c LIMIT 5; a b c 0 @@ -4638,8 +4638,8 @@ a b c 0 0 EXPLAIN SELECT * FROM t1 ORDER BY c, a LIMIT 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 24492 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 Using filesort SELECT * FROM t1 ORDER BY c, a LIMIT 5; a b c 0 @@ -4695,8 +4695,8 @@ DROP TABLE t1,t2; CREATE TABLE t1 (a INT NOT NULL, b INT); INSERT INTO t1 VALUES (1, 1); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select 1 AS `a`,1 AS `b` from dual where 1 SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; @@ -4705,18 +4705,18 @@ a b DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,NULL AS `c` from `test`.`t1` where 1 DROP TABLE t1; @@ -4810,39 +4810,39 @@ SELECT * FROM t1 WHERE a = 1 + 1; a 2 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = <cache>(1 + 1) SELECT * FROM t1 HAVING a = 1 + 1; a 2 EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having `test`.`t1`.`a` = <cache>(1 + 1) SELECT * FROM t1, t2 WHERE a = b + (1 + 1); a b 4 2 EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a = b + (1 + 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,2 AS `b` from `test`.`t1` where `test`.`t1`.`a` = <cache>(2 + (1 + 1)) SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1; b a 2 3 EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select 2 AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > <cache>(unix_timestamp('2009-03-10 00:00:00')) CREATE FUNCTION f1() RETURNS INT DETERMINISTIC @@ -4858,8 +4858,8 @@ SELECT @cnt; @cnt 1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = f1(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = <cache>(`f1`()) DROP TABLE t1, t2; @@ -4915,8 +4915,8 @@ DROP TABLE t1; CREATE TABLE t1(a ENUM('') NOT NULL); INSERT INTO t1 VALUES (), (), (); EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using filesort SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; 1 1 @@ -4943,13 +4943,13 @@ INSERT INTO t6 VALUES (9),(7); SET @save_join_buffer_size=@@join_buffer_size,@@join_buffer_size = 2176; EXPLAIN SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 12 -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) -1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.f1 1 -1 SIMPLE t5 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 SIMPLE t6 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 4 test.t1.f1 1 +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; f1 f1 f1 f1 f2 f1 f1 3 9 NULL NULL NULL 20 9 @@ -5026,20 +5026,20 @@ INSERT INTO t3 VALUES set @tmp= @@optimizer_switch; SET SESSION optimizer_switch='index_condition_pushdown=off'; EXPLAIN SELECT * from t1,t2,t3 WHERE t3.a3=t1.a1 AND t2.a2=t1.a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL idx NULL NULL NULL 3 -1 SIMPLE t2 ref idx idx 4 test.t1.a1 2 -1 SIMPLE t3 ref idx idx 4 test.t1.a1 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.a2=t1.a1 AND t3.a3=t1.a1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL idx NULL NULL NULL 3 -1 SIMPLE t2 ref idx idx 4 test.t1.a1 2 -1 SIMPLE t3 ref idx idx 4 test.t1.a1 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.a2=t1.a1 AND t3.a3=t2.a2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL idx NULL NULL NULL 3 -1 SIMPLE t2 ref idx idx 4 test.t1.a1 2 -1 SIMPLE t3 ref idx idx 4 test.t1.a1 5 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 SELECT * from t1,t2,t3 WHERE t3.a3=t1.a1 AND t2.a2=t1.a1 AND LENGTH(CONCAT(CONCAT(t1.b1,t2.b2),t3.b3)) <= 7; @@ -5129,14 +5129,14 @@ LEFT JOIN (((t4 JOIN t5 ON t4.f42=t5.f51) LEFT JOIN t6 ON t6.f62>0) JOIN t7 ON t6.f61>0) ON t3.f31 = t6.f61 WHERE t7.f71>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system PRIMARY,f32 NULL NULL NULL 1 -1 SIMPLE t5 system PRIMARY NULL NULL NULL 1 -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 ref f22 f22 5 const 1 -1 SIMPLE t4 ref f42 f42 5 const 1 Using index -1 SIMPLE t6 ref f61 f61 5 const 1 Using where -1 SIMPLE t7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL system PRIMARY,f32 NULL NULL NULL 1 +1 SIMPLE t5 NULL system PRIMARY NULL NULL NULL 1 +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL ref f22 f22 5 const 1 +1 SIMPLE t4 NULL ref f42 f42 5 const 1 Using index +1 SIMPLE t6 NULL ref f61 f61 5 const 1 Using where +1 SIMPLE t7 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) SELECT t2.f23 FROM (t1 LEFT JOIN (t2 JOIN t3 ON t2.f22=t3.f32) ON t1.f11=t3.f31) LEFT JOIN @@ -5190,8 +5190,8 @@ LEFT OUTER JOIN (t2 INNER JOIN t_empty ON TRUE) ON t1.pk=t2.pk WHERE t2.pk <> 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 @@ -5208,8 +5208,8 @@ LEFT OUTER JOIN (t2 CROSS JOIN t_empty) ON t1.pk=t2.pk WHERE t2.pk <> 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 @@ -5226,8 +5226,8 @@ LEFT OUTER JOIN (t2 INNER JOIN t_empty ON t_empty.i=t2.i) ON t1.pk=t2.pk WHERE t2.pk <> 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 @@ -5256,8 +5256,8 @@ INSERT INTO `CC` VALUES ,'x'); EXPLAIN SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4 HAVING G1 ORDER BY `varchar_key` LIMIT 6 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CC range int_key int_key 4 NULL 9 Using index condition; Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE CC NULL range int_key int_key 4 NULL 9 Using index condition; Using where; Using filesort SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4 HAVING G1 ORDER BY `varchar_key` LIMIT 6 ; G1 @@ -5279,8 +5279,8 @@ a b 2 2 EXPLAIN SELECT * FROM t1 WHERE a = b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 DROP TABLE t1; # # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on @@ -5401,8 +5401,8 @@ SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0; pk a EXPLAIN EXTENDED SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 2 AS `pk`,0 AS `a` from `test`.`t1` where 0 DROP TABLE t1; @@ -5423,9 +5423,9 @@ INSERT INTO t2 VALUES (8), (9); EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON ( c = a ) WHERE 1 IS NULL OR b < 33 AND b = c; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system idx NULL NULL NULL 1 100.00 -1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system idx NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL ref idx idx 5 const 1 100.00 Using index Warnings: Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`c` = 8 SELECT * FROM t1 INNER JOIN t2 ON ( c = a ) @@ -5454,8 +5454,8 @@ CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,101),(2,102),(3,103),(4,104),(5,11); EXPLAIN EXTENDED SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1); @@ -5463,8 +5463,8 @@ a b 5 11 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5); @@ -5472,8 +5472,8 @@ a b 5 11 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` = 5 and `test`.`t1`.`b` <> 1 SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1); @@ -5481,16 +5481,16 @@ a b 5 11 EXPLAIN EXTENDED SELECT * FROM t1 WHERE (b = 1 OR a = 1) AND (b = 5 AND a = 5 OR 1 != 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where 0 SELECT * FROM t1 WHERE (b = 1 OR a = 1) AND (b = 5 AND a = 5 OR 1 != 1); a b EXPLAIN EXTENDED SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 5 and `test`.`t1`.`a` = 5 SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1); @@ -5506,9 +5506,9 @@ CREATE TABLE t2 (c varchar(1), d varchar(1)) ENGINE=MyISAM; INSERT INTO t2 VALUES ('k','k'); EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,'k' AS `c`,'k' AS `d` from `test`.`t1` where `test`.`t1`.`b` = 'k' and `test`.`t1`.`a` = 136 SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b)); @@ -5525,8 +5525,8 @@ INSERT INTO t2 VALUES (8), (9); EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 1 AS `i1`,8 AS `j1`,NULL AS `i2` from `test`.`t2` where 0 SELECT * FROM t1, t2 @@ -5547,9 +5547,9 @@ pk1 a1 b1 pk2 a2 EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a1 = pk2 AND ( ( b1 = 6 OR a2 > 4 ) AND pk2 = a2 OR pk1 IS NULL ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system PRIMARY NULL NULL NULL 1 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,1 AS `pk2`,1 AS `a2` from `test`.`t1` where `test`.`t1`.`a1` = 1 and `test`.`t1`.`b1` = 6 INSERT INTO t1 VALUES (3,1,6); diff --git a/mysql-test/main/select_safe.result b/mysql-test/main/select_safe.result index 649e2dc484e..06f6a67e09d 100644 --- a/mysql-test/main/select_safe.result +++ b/mysql-test/main/select_safe.result @@ -68,14 +68,14 @@ insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(nu insert into t1 values (null,"b"),(null,"b"),(null,"c"),(null,"c"),(null,"d"),(null,"d"),(null,"e"),(null,"e"),(null,"a"),(null,"e"); insert into t1 values (null,"x"),(null,"x"),(null,"y"),(null,"y"),(null,"z"),(null,"z"),(null,"v"),(null,"v"),(null,"a"),(null,"v"); explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL b NULL NULL NULL 11 -1 SIMPLE t2 ALL b NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL b NULL NULL NULL 11 +1 SIMPLE t2 NULL ALL b NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) set MAX_SEEKS_FOR_KEY=1; explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL b NULL NULL NULL 11 -1 SIMPLE t2 ALL b NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL b NULL NULL NULL 11 +1 SIMPLE t2 NULL ALL b NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) SET MAX_SEEKS_FOR_KEY=DEFAULT; drop table t1; create table t1 (a int); diff --git a/mysql-test/main/selectivity.result b/mysql-test/main/selectivity.result index 003b91a6a28..e9d410cccad 100644 --- a/mysql-test/main/selectivity.result +++ b/mysql-test/main/selectivity.result @@ -27,14 +27,14 @@ test t1 a 1 9 0.4000 4.0000 1.2000 0 NULL NULL flush table t1; explain extended select * from t1 where a is null; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 40.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 40.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null explain extended select * from t1 where a is not null; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 60.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 60.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not null drop table t1; @@ -71,16 +71,16 @@ and r_name = 'ASIA' ) order by s_acctbal desc, n_name, s_name, p_partkey; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 0.31 Using where; Using temporary; Using filesort -1 PRIMARY partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 Using where -1 PRIMARY supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.partsupp.ps_suppkey 1 100.00 Using where -1 PRIMARY nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where -1 PRIMARY region eq_ref PRIMARY PRIMARY 4 dbt3_s001.nation.n_regionkey 1 20.00 Using where -2 DEPENDENT SUBQUERY region ALL PRIMARY NULL NULL NULL 5 20.00 Using where -2 DEPENDENT SUBQUERY partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 -2 DEPENDENT SUBQUERY supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.partsupp.ps_suppkey 1 100.00 Using where -2 DEPENDENT SUBQUERY nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY part NULL ALL PRIMARY NULL NULL NULL 200 0.31 Using where; Using temporary; Using filesort +1 PRIMARY partsupp NULL ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 Using where +1 PRIMARY supplier NULL eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.partsupp.ps_suppkey 1 100.00 Using where +1 PRIMARY nation NULL eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where +1 PRIMARY region NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.nation.n_regionkey 1 20.00 Using where +2 DEPENDENT SUBQUERY region NULL ALL PRIMARY NULL NULL NULL 5 20.00 Using where +2 DEPENDENT SUBQUERY partsupp NULL ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 +2 DEPENDENT SUBQUERY supplier NULL eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.partsupp.ps_suppkey 1 100.00 Using where +2 DEPENDENT SUBQUERY nation NULL eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.part.p_partkey' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`part`.`p_size` = 9 and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`region`.`r_regionkey` = `dbt3_s001`.`nation`.`n_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_type` like '%TIN' and `dbt3_s001`.`partsupp`.`ps_suppl ycost` = <expr_cache><`dbt3_s001`.`part`.`p_partkey`>((/* select#2 */ select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey` @@ -112,16 +112,16 @@ and r_name = 'ASIA' ) order by s_acctbal desc, n_name, s_name, p_partkey; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY region ALL PRIMARY NULL NULL NULL 5 20.00 Using where; Using temporary; Using filesort -1 PRIMARY nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 100.00 -1 PRIMARY supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00 -1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 2.08 Using where; Using join buffer (flat, BNL join) -1 PRIMARY partsupp eq_ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 8 dbt3_s001.part.p_partkey,dbt3_s001.supplier.s_suppkey 1 100.00 Using where -2 DEPENDENT SUBQUERY region ALL PRIMARY NULL NULL NULL 5 20.00 Using where -2 DEPENDENT SUBQUERY partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 -2 DEPENDENT SUBQUERY supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.partsupp.ps_suppkey 1 100.00 Using where -2 DEPENDENT SUBQUERY nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY region NULL ALL PRIMARY NULL NULL NULL 5 20.00 Using where; Using temporary; Using filesort +1 PRIMARY nation NULL ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 100.00 +1 PRIMARY supplier NULL ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00 +1 PRIMARY part NULL ALL PRIMARY NULL NULL NULL 200 2.08 Using where; Using join buffer (flat, BNL join) +1 PRIMARY partsupp NULL eq_ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 8 dbt3_s001.part.p_partkey,dbt3_s001.supplier.s_suppkey 1 100.00 Using where +2 DEPENDENT SUBQUERY region NULL ALL PRIMARY NULL NULL NULL 5 20.00 Using where +2 DEPENDENT SUBQUERY partsupp NULL ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 +2 DEPENDENT SUBQUERY supplier NULL eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.partsupp.ps_suppkey 1 100.00 Using where +2 DEPENDENT SUBQUERY nation NULL eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.part.p_partkey' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `dbt3_s001`.`supplier`.`s_acctbal` AS `s_acctbal`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`nation`.`n_name` AS `n_name`,`dbt3_s001`.`part`.`p_partkey` AS `p_partkey`,`dbt3_s001`.`part`.`p_mfgr` AS `p_mfgr`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`dbt3_s001`.`supplier`.`s_comment` AS `s_comment` from `dbt3_s001`.`part` join `dbt3_s001`.`supplier` join `dbt3_s001`.`partsupp` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`partsupp`.`ps_suppkey` = `dbt3_s001`.`supplier`.`s_suppkey` and `dbt3_s001`.`part`.`p_size` = 9 and `dbt3_s001`.`supplier`.`s_nationkey` = `dbt3_s001`.`nation`.`n_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_type` like '%TIN' and `dbt3_s001`.`partsupp`.`ps_suppl ycost` = <expr_cache><`dbt3_s001`.`part`.`p_partkey`>((/* select#2 */ select min(`dbt3_s001`.`partsupp`.`ps_supplycost`) from `dbt3_s001`.`partsupp` join `dbt3_s001`.`supplier` join `dbt3_s001`.`nation` join `dbt3_s001`.`region` where `dbt3_s001`.`supplier`.`s_suppkey` = `dbt3_s001`.`partsupp`.`ps_suppkey` and `dbt3_s001`.`nation`.`n_nationkey` = `dbt3_s001`.`supplier`.`s_nationkey` and `dbt3_s001`.`nation`.`n_regionkey` = `dbt3_s001`.`region`.`r_regionkey` and `dbt3_s001`.`region`.`r_name` = 'ASIA' and `dbt3_s001`.`part`.`p_partkey` = `dbt3_s001`.`partsupp`.`ps_partkey`)) order by `dbt3_s001`.`supplier`.`s_acctbal` desc,`dbt3_s001`.`nation`.`n_name`,`dbt3_s001`.`supplier`.`s_name`,`dbt3_s001`.`part`.`p_partkey` @@ -141,12 +141,12 @@ from supplier, revenue0 where s_suppkey = supplier_no and total_revenue = (select max(total_revenue) from revenue0) order by s_suppkey; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using filesort -1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 10 100.00 Using where -3 DERIVED lineitem range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort -2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 269 100.00 -4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY supplier NULL ALL PRIMARY NULL NULL NULL 10 100.00 Using filesort +1 PRIMARY <derived3> NULL ref key0 key0 5 dbt3_s001.supplier.s_suppkey 10 100.00 Using where +3 DERIVED lineitem NULL range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort +2 SUBQUERY <derived4> NULL ALL NULL NULL NULL NULL 269 100.00 +4 DERIVED lineitem NULL range i_l_shipdate i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (/* select#2 */ select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey` select s_suppkey, s_name, s_address, s_phone, total_revenue @@ -162,12 +162,12 @@ from supplier, revenue0 where s_suppkey = supplier_no and total_revenue = (select max(total_revenue) from revenue0) order by s_suppkey; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using filesort -1 PRIMARY <derived3> ref key0 key0 5 dbt3_s001.supplier.s_suppkey 10 100.00 Using where -3 DERIVED lineitem range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort -2 SUBQUERY <derived4> ALL NULL NULL NULL NULL 269 100.00 -4 DERIVED lineitem range i_l_shipdate i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY supplier NULL ALL PRIMARY NULL NULL NULL 10 100.00 Using filesort +1 PRIMARY <derived3> NULL ref key0 key0 5 dbt3_s001.supplier.s_suppkey 10 100.00 Using where +3 DERIVED lineitem NULL range i_l_shipdate,i_l_suppkey i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort +2 SUBQUERY <derived4> NULL ALL NULL NULL NULL NULL 269 100.00 +4 DERIVED lineitem NULL range i_l_shipdate i_l_shipdate 4 NULL 269 100.00 Using where; Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `dbt3_s001`.`supplier`.`s_suppkey` AS `s_suppkey`,`dbt3_s001`.`supplier`.`s_name` AS `s_name`,`dbt3_s001`.`supplier`.`s_address` AS `s_address`,`dbt3_s001`.`supplier`.`s_phone` AS `s_phone`,`revenue0`.`total_revenue` AS `total_revenue` from `dbt3_s001`.`supplier` join `dbt3_s001`.`revenue0` where `revenue0`.`supplier_no` = `dbt3_s001`.`supplier`.`s_suppkey` and `revenue0`.`total_revenue` = (/* select#2 */ select max(`revenue0`.`total_revenue`) from `dbt3_s001`.`revenue0`) order by `dbt3_s001`.`supplier`.`s_suppkey` select s_suppkey, s_name, s_address, s_phone, total_revenue @@ -191,10 +191,10 @@ and ps_suppkey not in (select s_suppkey from supplier where s_comment like '%Customer%Complaints%') group by p_brand, p_type, p_size order by supplier_cnt desc, p_brand, p_type, p_size; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 100.00 Using where; Using temporary; Using filesort -1 PRIMARY partsupp ref PRIMARY,i_ps_partkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index -2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY part NULL ALL PRIMARY NULL NULL NULL 200 100.00 Using where; Using temporary; Using filesort +1 PRIMARY partsupp NULL ref PRIMARY,i_ps_partkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index +2 MATERIALIZED supplier NULL ALL PRIMARY NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 /* select#1 */ select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (/* select#2 */ select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_supp key`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt @@ -235,10 +235,10 @@ and ps_suppkey not in (select s_suppkey from supplier where s_comment like '%Customer%Complaints%') group by p_brand, p_type, p_size order by supplier_cnt desc, p_brand, p_type, p_size; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 16.67 Using where; Using temporary; Using filesort -1 PRIMARY partsupp ref PRIMARY,i_ps_partkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index -2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY part NULL ALL PRIMARY NULL NULL NULL 200 16.67 Using where; Using temporary; Using filesort +1 PRIMARY partsupp NULL ref PRIMARY,i_ps_partkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index +2 MATERIALIZED supplier NULL ALL PRIMARY NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 /* select#1 */ select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (/* select#2 */ select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_supp key`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt @@ -279,10 +279,10 @@ and ps_suppkey not in (select s_suppkey from supplier where s_comment like '%Customer%Complaints%') group by p_brand, p_type, p_size order by supplier_cnt desc, p_brand, p_type, p_size; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 16.67 Using where; Using temporary; Using filesort -1 PRIMARY partsupp ref PRIMARY,i_ps_partkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index -2 MATERIALIZED supplier ALL PRIMARY NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY part NULL ALL PRIMARY NULL NULL NULL 200 16.67 Using where; Using temporary; Using filesort +1 PRIMARY partsupp NULL ref PRIMARY,i_ps_partkey PRIMARY 4 dbt3_s001.part.p_partkey 3 100.00 Using where; Using index +2 MATERIALIZED supplier NULL ALL PRIMARY NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 /* select#1 */ select `dbt3_s001`.`part`.`p_brand` AS `p_brand`,`dbt3_s001`.`part`.`p_type` AS `p_type`,`dbt3_s001`.`part`.`p_size` AS `p_size`,count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) AS `supplier_cnt` from `dbt3_s001`.`partsupp` join `dbt3_s001`.`part` where `dbt3_s001`.`partsupp`.`ps_partkey` = `dbt3_s001`.`part`.`p_partkey` and `dbt3_s001`.`part`.`p_brand` <> 'Brand#11' and `dbt3_s001`.`part`.`p_type` not like 'SMALL POLISHED%' and `dbt3_s001`.`part`.`p_size` in (49,37,27,5,40,6,22,8) and !<expr_cache><`dbt3_s001`.`partsupp`.`ps_suppkey`>(<in_optimizer>(`dbt3_s001`.`partsupp`.`ps_suppkey`,`dbt3_s001`.`partsupp`.`ps_suppkey` in ( <materialize> (/* select#2 */ select `dbt3_s001`.`supplier`.`s_suppkey` from `dbt3_s001`.`supplier` where `dbt3_s001`.`supplier`.`s_comment` like '%Customer%Complaints%' ), <primary_index_lookup>(`dbt3_s001`.`partsupp`.`ps_suppkey` in <temporary table> on distinct_key where `dbt3_s001`.`partsupp`.`ps_suppkey` = `<subquery2>`.`s_supp key`)))) group by `dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` order by count(distinct `dbt3_s001`.`partsupp`.`ps_suppkey`) desc,`dbt3_s001`.`part`.`p_brand`,`dbt3_s001`.`part`.`p_type`,`dbt3_s001`.`part`.`p_size` select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt @@ -324,12 +324,12 @@ and c_custkey = o_custkey and o_orderkey = l_orderkey group by c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice order by o_totalprice desc, o_orderdate; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY orders ALL PRIMARY,i_o_custkey NULL NULL NULL 1500 100.00 Using where; Using temporary; Using filesort -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00 -1 PRIMARY customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 100.00 -1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index -2 MATERIALIZED lineitem index NULL i_l_orderkey_quantity 13 NULL 6005 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY orders NULL ALL PRIMARY,i_o_custkey NULL NULL NULL 1500 100.00 Using where; Using temporary; Using filesort +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00 +1 PRIMARY customer NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 100.00 +1 PRIMARY lineitem NULL ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index +2 MATERIALIZED lineitem NULL index NULL i_l_orderkey_quantity 13 NULL 6005 100.00 Using index Warnings: Note 1003 /* select#1 */ select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (/* select#2 */ select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and `<subquery2>`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`, `dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE` select @@ -358,12 +358,12 @@ and c_custkey = o_custkey and o_orderkey = l_orderkey group by c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice order by o_totalprice desc, o_orderdate; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY orders ALL PRIMARY,i_o_custkey NULL NULL NULL 1500 100.00 Using where; Using temporary; Using filesort -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00 -1 PRIMARY customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 100.00 -1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index -2 MATERIALIZED lineitem index NULL i_l_orderkey_quantity 13 NULL 6005 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY orders NULL ALL PRIMARY,i_o_custkey NULL NULL NULL 1500 100.00 Using where; Using temporary; Using filesort +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00 +1 PRIMARY customer NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 100.00 +1 PRIMARY lineitem NULL ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index +2 MATERIALIZED lineitem NULL index NULL i_l_orderkey_quantity 13 NULL 6005 100.00 Using index Warnings: Note 1003 /* select#1 */ select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (/* select#2 */ select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and `<subquery2>`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`, `dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE` select @@ -397,10 +397,10 @@ and not exists (select * from orders where o_custkey = c_custkey) ) as vip group by cntrycode order by cntrycode; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY customer ALL NULL NULL NULL NULL 150 100.00 Using where; Using temporary; Using filesort -4 DEPENDENT SUBQUERY orders ref i_o_custkey i_o_custkey 5 dbt3_s001.customer.c_custkey 15 100.00 Using index -3 SUBQUERY customer ALL NULL NULL NULL NULL 150 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY customer NULL ALL NULL NULL NULL NULL 150 100.00 Using where; Using temporary; Using filesort +4 DEPENDENT SUBQUERY orders NULL ref i_o_custkey i_o_custkey 5 dbt3_s001.customer.c_custkey 15 100.00 Using index +3 SUBQUERY customer NULL ALL NULL NULL NULL NULL 150 100.00 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2 Note 1003 /* select#1 */ select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (/* select#3 */ select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !<in_optimizer>(1,<expr_cache><`dbt3_s001`.`customer`.`c_custkey`>(exists(/* select#4 */ select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey` limit 1))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) @@ -438,10 +438,10 @@ and not exists (select * from orders where o_custkey = c_custkey) ) as vip group by cntrycode order by cntrycode; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY customer ALL NULL NULL NULL NULL 150 100.00 Using where; Using temporary; Using filesort -4 DEPENDENT SUBQUERY orders ref i_o_custkey i_o_custkey 5 dbt3_s001.customer.c_custkey 15 100.00 Using index -3 SUBQUERY customer ALL NULL NULL NULL NULL 150 91.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY customer NULL ALL NULL NULL NULL NULL 150 100.00 Using where; Using temporary; Using filesort +4 DEPENDENT SUBQUERY orders NULL ref i_o_custkey i_o_custkey 5 dbt3_s001.customer.c_custkey 15 100.00 Using index +3 SUBQUERY customer NULL ALL NULL NULL NULL NULL 150 91.00 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2 Note 1003 /* select#1 */ select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (/* select#3 */ select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !<in_optimizer>(1,<expr_cache><`dbt3_s001`.`customer`.`c_custkey`>(exists(/* select#4 */ select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey` limit 1))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) @@ -484,13 +484,13 @@ and s_nationkey = n_nationkey and n_name = 'UNITED STATES' order by s_name limit 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY supplier ALL PRIMARY,i_s_nationkey NULL NULL NULL 10 100.00 Using where; Using filesort -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -1 PRIMARY nation eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where -2 MATERIALIZED part ALL PRIMARY NULL NULL NULL 200 100.00 Using where -2 MATERIALIZED partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 Using where -4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY supplier NULL ALL PRIMARY,i_s_nationkey NULL NULL NULL 10 100.00 Using where; Using filesort +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY nation NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 Using where +2 MATERIALIZED part NULL ALL PRIMARY NULL NULL NULL 200 100.00 Using where +2 MATERIALIZED partsupp NULL ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_partkey 4 dbt3_s001.part.p_partkey 3 100.00 Using where +4 DEPENDENT SUBQUERY lineitem NULL ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 100.00 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 @@ -538,12 +538,12 @@ and s_nationkey = n_nationkey and n_name = 'UNITED STATES' order by s_name limit 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY nation ALL PRIMARY NULL NULL NULL 25 4.00 Using where; Using temporary; Using filesort -1 PRIMARY supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00 -1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 4.17 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY partsupp eq_ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 8 dbt3_s001.part.p_partkey,dbt3_s001.supplier.s_suppkey 1 100.00 Using where; End temporary -4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 15.14 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY nation NULL ALL PRIMARY NULL NULL NULL 25 4.00 Using where; Using temporary; Using filesort +1 PRIMARY supplier NULL ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00 +1 PRIMARY part NULL ALL PRIMARY NULL NULL NULL 200 4.17 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY partsupp NULL eq_ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 8 dbt3_s001.part.p_partkey,dbt3_s001.supplier.s_suppkey 1 100.00 Using where; End temporary +4 DEPENDENT SUBQUERY lineitem NULL ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 15.14 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 @@ -593,12 +593,12 @@ and s_nationkey = n_nationkey and n_name = 'UNITED STATES' order by s_name limit 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY nation ALL PRIMARY NULL NULL NULL 25 4.00 Using where; Using temporary; Using filesort -1 PRIMARY supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00 -1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 7.03 Using where -1 PRIMARY partsupp eq_ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 8 dbt3_s001.part.p_partkey,dbt3_s001.supplier.s_suppkey 1 100.00 Using where; FirstMatch(supplier) -4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 15.14 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY nation NULL ALL PRIMARY NULL NULL NULL 25 4.00 Using where; Using temporary; Using filesort +1 PRIMARY supplier NULL ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00 +1 PRIMARY part NULL ALL PRIMARY NULL NULL NULL 200 7.03 Using where +1 PRIMARY partsupp NULL eq_ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 8 dbt3_s001.part.p_partkey,dbt3_s001.supplier.s_suppkey 1 100.00 Using where; FirstMatch(supplier) +4 DEPENDENT SUBQUERY lineitem NULL ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 15.14 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 @@ -648,12 +648,12 @@ and s_nationkey = n_nationkey and n_name = 'UNITED STATES' order by s_name limit 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY nation ALL PRIMARY NULL NULL NULL 25 4.00 Using where; Using temporary; Using filesort -1 PRIMARY supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00 -1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 7.81 Using where -1 PRIMARY partsupp eq_ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 8 dbt3_s001.part.p_partkey,dbt3_s001.supplier.s_suppkey 1 100.00 Using where; FirstMatch(supplier) -4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 15.14 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY nation NULL ALL PRIMARY NULL NULL NULL 25 4.00 Using where; Using temporary; Using filesort +1 PRIMARY supplier NULL ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00 +1 PRIMARY part NULL ALL PRIMARY NULL NULL NULL 200 7.81 Using where +1 PRIMARY partsupp NULL eq_ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 8 dbt3_s001.part.p_partkey,dbt3_s001.supplier.s_suppkey 1 100.00 Using where; FirstMatch(supplier) +4 DEPENDENT SUBQUERY lineitem NULL ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 15.14 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 @@ -703,12 +703,12 @@ and s_nationkey = n_nationkey and n_name = 'UNITED STATES' order by s_name limit 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY nation ALL PRIMARY NULL NULL NULL 25 4.00 Using where; Using temporary; Using filesort -1 PRIMARY supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00 -1 PRIMARY part ALL PRIMARY NULL NULL NULL 200 7.81 Using where -1 PRIMARY partsupp eq_ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 8 dbt3_s001.part.p_partkey,dbt3_s001.supplier.s_suppkey 1 100.00 Using where; FirstMatch(supplier) -4 DEPENDENT SUBQUERY lineitem ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 15.14 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY nation NULL ALL PRIMARY NULL NULL NULL 25 4.00 Using where; Using temporary; Using filesort +1 PRIMARY supplier NULL ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00 +1 PRIMARY part NULL ALL PRIMARY NULL NULL NULL 200 7.81 Using where +1 PRIMARY partsupp NULL eq_ref PRIMARY,i_ps_partkey,i_ps_suppkey PRIMARY 8 dbt3_s001.part.p_partkey,dbt3_s001.supplier.s_suppkey 1 100.00 Using where; FirstMatch(supplier) +4 DEPENDENT SUBQUERY lineitem NULL ref i_l_shipdate,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.partsupp.ps_suppkey 8 15.14 Using where Warnings: Note 1276 Field or reference 'dbt3_s001.partsupp.ps_partkey' of SELECT #4 was resolved in SELECT #2 Note 1276 Field or reference 'dbt3_s001.partsupp.ps_suppkey' of SELECT #4 was resolved in SELECT #2 @@ -753,9 +753,9 @@ INSERT INTO t2 VALUES (1,9), (6,3), (2,8), (4,1), (0,7), (4,8), (4,5); EXPLAIN EXTENDED SELECT * FROM v1 INNER JOIN t2 ON ( a = c AND b = d ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t2 ref idx idx 5 test.t1.b 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t2 NULL ref idx idx 5 test.t1.b 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t2`.`d` = `test`.`t1`.`b` SELECT * FROM v1 INNER JOIN t2 ON ( a = c AND b = d ); @@ -775,8 +775,8 @@ insert into t1 values set optimizer_use_condition_selectivity=1; explain extended select * from t1 where a < 1 and a > 7; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1 and `test`.`t1`.`a` > 7 select * from t1 where a < 1 and a > 7; @@ -784,8 +784,8 @@ a set optimizer_use_condition_selectivity=3; explain extended select * from t1 where a < 1 and a > 7; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1 and `test`.`t1`.`a` > 7 select * from t1 where a < 1 and a > 7; @@ -797,8 +797,8 @@ create table t2 (b int); insert into t2 values (2),(3); explain extended select * from t1 where a in ( select b from t2 ) AND ( a > 3 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 1 AS `a` from (`test`.`t2`) where 0 select * from t1 where a in ( select b from t2 ) AND ( a > 3 ); @@ -833,8 +833,8 @@ test.t1 analyze status OK flush table t1; set optimizer_use_condition_selectivity=4; explain extended select * from t1 where a=0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.39 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1025 0.39 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0 drop table t1; @@ -868,8 +868,8 @@ INSERT INTO t2 VALUES (1), (7); set optimizer_use_condition_selectivity=1; EXPLAIN EXTENDED SELECT 1 FROM t1, t2 WHERE pk = 6 AND a = 2 AND b = 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 1 AS `1` from `test`.`t1` join `test`.`t2` where 0 SELECT 1 FROM t1, t2 WHERE pk = 6 AND a = 2 AND b = 10; @@ -877,8 +877,8 @@ SELECT 1 FROM t1, t2 WHERE pk = 6 AND a = 2 AND b = 10; set optimizer_use_condition_selectivity=3; EXPLAIN EXTENDED SELECT 1 FROM t1, t2 WHERE pk = 6 AND a = 2 AND b = 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select 1 AS `1` from `test`.`t1` join `test`.`t2` where 0 SELECT 1 FROM t1, t2 WHERE pk = 6 AND a = 2 AND b = 10; @@ -902,8 +902,8 @@ FLUSH TABLES; set optimizer_use_condition_selectivity=3; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > 3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 75.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 75.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 3 SELECT * FROM t1 WHERE a > 3; @@ -934,8 +934,8 @@ set @save_optimizer_switch=@@optimizer_switch; set optimizer_switch='index_condition_pushdown=off'; EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a > 9; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select NULL AS `a`,NULL AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where 0 SELECT * FROM t1, t2 WHERE a > 9; @@ -982,11 +982,11 @@ FLUSH TABLES; set optimizer_use_condition_selectivity=3; EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE EXISTS ( SELECT 1 FROM t1, t2 ) AND a != b OR a <= 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 14 100.00 Using where; Using join buffer (flat, BNL join) -2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 14 100.00 Using where; Using join buffer (flat, BNL join) +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 7 100.00 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where <cache>(<in_optimizer>(1,exists(/* select#2 */ select 1 from `test`.`t1` join `test`.`t2` limit 1))) and `test`.`t1`.`a` <> `test`.`t2`.`b` or `test`.`t1`.`a` <= 4 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; @@ -1008,26 +1008,26 @@ FLUSH TABLE t1; set optimizer_use_condition_selectivity=3; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 14 28.57 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 14 28.57 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IS NOT NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 14 71.43 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 14 71.43 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is not null EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IS NULL OR a IS NOT NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 14 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 14 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null or `test`.`t1`.`a` is not null EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IS NULL OR a < 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 14 69.39 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 14 69.39 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` is null or `test`.`t1`.`a` < 5 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; @@ -1135,8 +1135,8 @@ select count(*) from t1 where a between 5 and 7; count(*) 3 explain extended select * from t1 where a between 5 and 7; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 25.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 25.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` between 5 and 7 alter table t1 change column a a int; @@ -1146,8 +1146,8 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK flush table t1; explain extended select * from t1 where a between 5 and 7; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 25.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 25.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` between 5 and 7 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; @@ -1179,8 +1179,8 @@ i1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE 2 IN ( SELECT pk2 FROM t2 LEFT JOIN t3 ON (c3 = c2 ) WHERE i2 = 3 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` left join `test`.`t3` on(`test`.`t3`.`c3` = 'b')) where 0 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; @@ -1244,10 +1244,10 @@ lang_group lang code country_group cont_group cont EXPLAIN EXTENDED SELECT * FROM language, country, continent WHERE country_group = lang_group AND lang_group IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE country ALL NULL NULL NULL NULL 2 50.00 Using where -1 SIMPLE language ALL NULL NULL NULL NULL 6 16.67 Using where; Using join buffer (flat, BNL join) -1 SIMPLE continent ALL NULL NULL NULL NULL 6 100.00 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE country NULL ALL NULL NULL NULL NULL 2 50.00 Using where +1 SIMPLE language NULL ALL NULL NULL NULL NULL 6 16.67 Using where; Using join buffer (flat, BNL join) +1 SIMPLE continent NULL ALL NULL NULL NULL NULL 6 100.00 Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`language`.`lang_group` AS `lang_group`,`test`.`language`.`lang` AS `lang`,`test`.`country`.`code` AS `code`,`test`.`country`.`country_group` AS `country_group`,`test`.`continent`.`cont_group` AS `cont_group`,`test`.`continent`.`cont` AS `cont` from `test`.`language` join `test`.`country` join `test`.`continent` where `test`.`language`.`lang_group` = `test`.`country`.`country_group` and `test`.`country`.`country_group` is null set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; @@ -1292,10 +1292,10 @@ set optimizer_use_condition_selectivity=1; explain extended select * from t1, t2, t1 as t3 where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 262144 100.00 Using where -1 SIMPLE t2 ref c,d c 5 test.t1.b 5 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 262144 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 262144 100.00 Using where +1 SIMPLE t2 NULL ref c,d c 5 test.t1.b 5 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 262144 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`a` = `test`.`t2`.`d` and `test`.`t3`.`b` < 5 and `test`.`t1`.`a` < 2000 select * from t1, t2, t1 as t3 @@ -1309,10 +1309,10 @@ set optimizer_use_condition_selectivity=3; explain extended select * from t1, t2, t1 as t3 where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 262144 0.00 Using where -1 SIMPLE t2 ref c,d d 5 test.t3.a 7 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 262144 2.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 262144 0.00 Using where +1 SIMPLE t2 NULL ref c,d d 5 test.t3.a 7 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 262144 2.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where `test`.`t1`.`b` = `test`.`t2`.`c` and `test`.`t2`.`d` = `test`.`t3`.`a` and `test`.`t3`.`b` < 5 and `test`.`t1`.`a` < 2000 select * from t1, t2, t1 as t3 @@ -1338,9 +1338,9 @@ INSERT INTO t2 VALUES (1), (2); set optimizer_use_condition_selectivity=3; EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE c >= 0 OR a = b ; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 select 'foo' AS `a`,'foo' AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 1 SELECT * FROM t1, t2 WHERE c >= 0 OR a = b ; @@ -1371,16 +1371,16 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date explain extended select * from t1 straight_join t2 where t1.a=t2.a and t1.a<10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1.00 Using where -1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 1.00 Using where +1 SIMPLE t2 NULL ref a a 5 test.t1.a 10 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` < 10 explain extended select * from t1 straight_join t2 where t1.a=t2.a and t2.a<10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1.00 Using where -1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 1.00 Using where +1 SIMPLE t2 NULL ref a a 5 test.t1.a 10 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` < 10 set histogram_size=@save_histogram_size; @@ -1404,9 +1404,9 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain extended select * from t2 a straight_join t2 b where a.a is null; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE a ALL NULL NULL NULL NULL 1000 100.00 Using where -1 SIMPLE b ALL NULL NULL NULL NULL 1000 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a NULL ALL NULL NULL NULL NULL 1000 100.00 Using where +1 SIMPLE b NULL ALL NULL NULL NULL NULL 1000 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `a`,`test`.`b`.`b` AS `b` from `test`.`t2` `a` straight_join `test`.`t2` `b` where `test`.`a`.`a` is null set histogram_size=@save_histogram_size; @@ -1432,9 +1432,9 @@ set optimizer_use_condition_selectivity=3; EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a <> 'USARussian' AND b IS NULL; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref PRIMARY,b b 5 const 1 100.00 Using index condition; Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref PRIMARY,b b 5 const 1 100.00 Using index condition; Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`i` AS `i` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` <> 'USARussian' and `test`.`t1`.`b` is null SELECT * FROM t1, t2 @@ -1456,8 +1456,8 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain extended select * from t1 where col1 > 'b' and col1 < 'e'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` > 'b' and `test`.`t1`.`col1` < 'e' select * from t1 where col1 > 'b' and col1 < 'e'; @@ -1491,8 +1491,8 @@ col1 c explain extended select * from t1 where col1 > 'b' and col1 < 'd'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 28.57 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 28.57 Using where Warnings: Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` > 'b' and `test`.`t1`.`col1` < 'd' select * from t2 where col1 > 'b' and col1 < 'd'; @@ -1500,16 +1500,16 @@ col1 c explain extended select * from t2 where col1 > 'b' and col1 < 'd'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` > 'b' and `test`.`t2`.`col1` < 'd' select * from t2 where col1 < 'b' and col1 > 'd'; col1 explain extended select * from t2 where col1 < 'b' and col1 > 'd'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` < 'b' and `test`.`t2`.`col1` > 'd' drop table t1,t2; @@ -1544,10 +1544,10 @@ insert into t1 values (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9 (11,11),(12,12),(13,13),(14,14),(15,15); set @@optimizer_use_condition_selectivity=2; explain extended select * from t1 where a in (select max(a) from t1 group by b); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1.a 1 100.00 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 16 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t1.a 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 16 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (/* select#2 */ select max(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`b`) join `test`.`t1` where `<subquery2>`.`max(a)` = `test`.`t1`.`a` select * from t1 where a in (select max(a) from t1 group by b); @@ -1570,10 +1570,10 @@ a b 15 15 set @@optimizer_use_condition_selectivity=1; explain extended select * from t1 where a in (select max(a) from t1 group by b); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 16 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1.a 1 100.00 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 16 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t1.a 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 16 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (/* select#2 */ select max(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`b`) join `test`.`t1` where `<subquery2>`.`max(a)` = `test`.`t1`.`a` select * from t1 where a in (select max(a) from t1 group by b); @@ -1648,20 +1648,20 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date # Check what info the optimizer has about selectivities explain extended select * from t1 use index () where a in (17,51,5); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 2.90 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 2.90 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` USE INDEX () where `test`.`t1`.`a` in (17,51,5) explain extended select * from t1 use index () where b=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 5.90 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 5.90 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` USE INDEX () where `test`.`t1`.`b` = 2 # Now, the equality is used for ref access, while the range condition # gives selectivity data explain extended select * from t1 where a in (17,51,5) and b=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref|filter b,a b|a 5|5 const 58 (3%) 2.90 Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter b,a b|a 5|5 const 58 (3%) 2.90 Using where; Using rowid filter Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` in (17,51,5) drop table t1; @@ -1706,8 +1706,8 @@ CREATE INDEX CountryName ON City(Country,Name); set @@optimizer_use_condition_selectivity=2; EXPLAIN SELECT * FROM City WHERE Country='FIN'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City ref Country,CountryPopulation,CountryName CountryName 3 const 5 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE City NULL ref Country,CountryPopulation,CountryName CountryName 3 const 5 Using index condition DROP DATABASE world; use test; CREATE TABLE t1 ( @@ -1738,8 +1738,8 @@ INSERT INTO t1 SELECT a + 640, b, c FROM t1; INSERT INTO t1 SELECT a + 1280, b, c FROM t1 LIMIT 80; EXPLAIN SELECT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 9; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range b,b_2 b 4 NULL 226 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range b,b_2 b 4 NULL 226 Using where SELECT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 9; a 2071 @@ -1767,10 +1767,10 @@ insert into t3 select seq-1,seq-1,seq-1 from seq_1_to_100 limit 30; set optimizer_use_condition_selectivity=1; explain extended select t1.b,t2.a,t3.a,t3.b from t1,t2,t3 where t1.c = t2.a AND t1.d = t3.a and t1.a = 50 and t1.b <= 100; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 10 NULL 9 100.00 Using index condition; Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.d 1 100.00 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 10 NULL 9 100.00 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.d 1 100.00 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Using index Warnings: Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a` = `test`.`t1`.`c` and `test`.`t3`.`a` = `test`.`t1`.`d` and `test`.`t1`.`a` = 50 and `test`.`t1`.`b` <= 100 select t1.b,t2.a,t3.a,t3.b from t1,t2,t3 @@ -1789,10 +1789,10 @@ b a a b set optimizer_use_condition_selectivity=2; explain extended select t1.b,t2.a,t3.a,t3.b from t1,t2,t3 where t1.c = t2.a AND t1.d = t3.a and t1.a = 50 and t1.b <= 100; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 10 NULL 9 9.00 Using index condition; Using where -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.d 1 100.00 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 10 NULL 9 9.00 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.d 1 100.00 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Using index Warnings: Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a` = `test`.`t1`.`c` and `test`.`t3`.`a` = `test`.`t1`.`d` and `test`.`t1`.`a` = 50 and `test`.`t1`.`b` <= 100 select t1.b,t2.a,t3.a,t3.b from t1,t2,t3 @@ -1847,22 +1847,22 @@ explain SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 A INNER JOIN t2 ON t2.a = A.id WHERE A.a=t1.a AND t2.b < 20); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 100 Using where -2 DEPENDENT SUBQUERY A ref PRIMARY,a a 5 test.t1.a 1 -2 DEPENDENT SUBQUERY t2 ref|filter a,b a|b 5|5 test.A.id 1 (10%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 100 Using where +2 DEPENDENT SUBQUERY A NULL ref PRIMARY,a a 5 test.t1.a 1 +2 DEPENDENT SUBQUERY t2 NULL ref|filter a,b a|b 5|5 test.A.id 1 (10%) Using where; Using rowid filter EXPLAIN SELECT * FROM t1 A, t1 B WHERE A.a = B.a and A.id = 65; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A const PRIMARY,a PRIMARY 4 const 1 -1 SIMPLE B ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL const PRIMARY,a PRIMARY 4 const 1 +1 SIMPLE B NULL ref a a 5 const 1 explain SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 A INNER JOIN t2 ON t2.a = A.id WHERE A.a=t1.a AND t2.b < 20); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 100 Using where -2 DEPENDENT SUBQUERY A ref PRIMARY,a a 5 test.t1.a 1 -2 DEPENDENT SUBQUERY t2 ref|filter a,b a|b 5|5 test.A.id 1 (10%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 100 Using where +2 DEPENDENT SUBQUERY A NULL ref PRIMARY,a a 5 test.t1.a 1 +2 DEPENDENT SUBQUERY t2 NULL ref|filter a,b a|b 5|5 test.A.id 1 (10%) Using where; Using rowid filter set optimizer_switch= @save_optimizer_switch; set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; drop table t1,t2; @@ -1894,8 +1894,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN EXTENDED SELECT * from t1 where t1.a >= 81; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 66.67 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 66.67 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` >= 81 SELECT HEX(a), b from t1 where t1.a >= 81; @@ -1918,21 +1918,21 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 40.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 40.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 SET optimizer_use_condition_selectivity=3; # filtered should show 25 % EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 25.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 25.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; diff --git a/mysql-test/main/selectivity_no_engine.result b/mysql-test/main/selectivity_no_engine.result index 3811b12a1be..f0e18ff1df0 100644 --- a/mysql-test/main/selectivity_no_engine.result +++ b/mysql-test/main/selectivity_no_engine.result @@ -35,13 +35,13 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK # The following two must have the same in 'Extra' column: explain extended select * from t2 where col1 IN (20, 180); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.35 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1100 1.35 Using where Warnings: Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (20,180) explain extended select * from t2 where col1 IN (180, 20); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.35 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1100 1.35 Using where Warnings: Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (180,20) drop table t1, t2; @@ -62,26 +62,26 @@ set use_stat_tables='preferably'; set optimizer_use_condition_selectivity=4; # Should select about 10%: explain extended select * from t1 where a=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.52 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 9.52 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 # Should select about 10%: explain extended select * from t1 where a=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.52 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 9.52 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 # Must not have filtered=100%: explain extended select * from t1 where a=0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.52 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 9.52 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0 # Again, must not have filtered=100%: explain extended select * from t1 where a=-1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.52 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 9.52 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = -1 drop table t0, t1; @@ -101,19 +101,19 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain extended select * from t1 where col1 in (1,2,3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 3.37 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10000 3.37 Using where Warnings: Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` in (1,2,3) # Must not cause fp division by zero, or produce nonsense numbers: explain extended select * from t1 where col1 in (-1,-2,-3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 5.94 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10000 5.94 Using where Warnings: Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` in (-1,-2,-3) explain extended select * from t1 where col1<=-1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 1.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10000 1.00 Using where Warnings: Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` <= -1 drop table t1, t2; @@ -133,8 +133,8 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date # This must show filtered=100%: explain extended select * from t2 where a in (1,2,3) and b in (1,2,3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 range a a 10 NULL 9 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 10 NULL 9 100.00 Using index condition Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col2` AS `col2` from `test`.`t2` where `test`.`t2`.`a` in (1,2,3) and `test`.`t2`.`b` in (1,2,3) drop table t2, t1; @@ -154,14 +154,14 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date # 10% is ok explain extended select * from t1 where col1=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 9.90 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 9.90 Using where Warnings: Note 1003 select `test`.`t1`.`key1` AS `key1`,`test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` = 2 # Must show 100%, not 10% explain extended select * from t1 where key1=2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref key1 key1 5 const 99 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref key1 key1 5 const 99 100.00 Warnings: Note 1003 select `test`.`t1`.`key1` AS `key1`,`test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`key1` = 2 drop table t0, t1; @@ -191,16 +191,16 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date # NOTE: 10*100%, 10*100% rows is ok explain extended select * from t0, t1 where t1.kp1=t0.a and t1.kp2=t0.a+1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 100.00 Using where -1 SIMPLE t1 ref kp1 kp1 10 test.t0.a,func 10 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 SIMPLE t1 NULL ref kp1 kp1 10 test.t0.a,func 10 100.00 Using index condition Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t1`.`kp1` AS `kp1`,`test`.`t1`.`kp2` AS `kp2`,`test`.`t1`.`filler1` AS `filler1`,`test`.`t1`.`filler2` AS `filler2` from `test`.`t0` join `test`.`t1` where `test`.`t1`.`kp1` = `test`.`t0`.`a` and `test`.`t1`.`kp2` = `test`.`t0`.`a` + 1 # NOTE: t0: 10*100% is ok, t1: 10*9.90% is bad. t1 should have 10*100%. explain extended select * from t0, t1 where t1.kp1=t0.a and t1.kp2=4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 100.00 Using where -1 SIMPLE t1 ref kp1 kp1 10 test.t0.a,const 10 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 SIMPLE t1 NULL ref kp1 kp1 10 test.t0.a,const 10 100.00 Warnings: Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t1`.`kp1` AS `kp1`,`test`.`t1`.`kp2` AS `kp2`,`test`.`t1`.`filler1` AS `filler1`,`test`.`t1`.`filler2` AS `filler2` from `test`.`t0` join `test`.`t1` where `test`.`t1`.`kp1` = `test`.`t0`.`a` and `test`.`t1`.`kp2` = 4 drop table t0, t1; @@ -235,9 +235,9 @@ INSERT INTO t2 VALUES ('foo','bazz','qux'),('bar','bazz','qux'); set optimizer_use_condition_selectivity=2; explain select * from t1,t2 where t1.id = t2.t1_id and t2.f2='qux' and t2.f1='baz'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref f1 f1 325 const,const 2 Using index condition; Using where -1 SIMPLE t1 eq_ref PRIMARY PRIMARY 122 test.t2.t1_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref f1 f1 325 const,const 2 Using index condition; Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 122 test.t2.t1_id 1 select * from t1,t2 where t1.id = t2.t1_id and t2.f2='qux' and t2.f1='baz'; id dt t1_id f1 f2 foo 2011-04-12 05:18:08 foo baz qux @@ -264,16 +264,16 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK # Filtered will be 4.95, 9.90 explain extended select * from t1 ta, t2 tb where ta.a < 40 and tb.a < 100; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE ta ALL NULL NULL NULL NULL 1000 4.95 Using where -1 SIMPLE tb ALL NULL NULL NULL NULL 1000 9.90 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE ta NULL ALL NULL NULL NULL NULL 1000 4.95 Using where +1 SIMPLE tb NULL ALL NULL NULL NULL NULL 1000 9.90 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where `test`.`ta`.`a` < 40 and `test`.`tb`.`a` < 100 # Here, tb.filtered should not become 100%: explain extended select * from t1 ta, t2 tb where ta.a < 40 and tb.a < 100 and tb.a=ta.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE ta ALL NULL NULL NULL NULL 1000 4.95 Using where -1 SIMPLE tb ALL NULL NULL NULL NULL 1000 4.95 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE ta NULL ALL NULL NULL NULL NULL 1000 4.95 Using where +1 SIMPLE tb NULL ALL NULL NULL NULL NULL 1000 4.95 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`ta`.`a` AS `a`,`test`.`tb`.`a` AS `a` from `test`.`t1` `ta` join `test`.`t2` `tb` where `test`.`tb`.`a` = `test`.`ta`.`a` and `test`.`ta`.`a` < 40 and `test`.`ta`.`a` < 100 drop table t0,t1,t2; @@ -310,9 +310,9 @@ CREATE TABLE t2 (c2 INT); INSERT INTO t2 VALUES (1); EXPLAIN SELECT * FROM t1 AS a NATURAL JOIN t1 AS b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE a ALL NULL NULL NULL NULL 5 Using where -1 SIMPLE b hash_ALL NULL #hash#$hj 1341 test.a.Host,test.a.User,test.a.Password,test.a.Select_priv,test.a.Insert_priv,test.a.Update_priv,test.a.Delete_priv,test.a.Create_priv,test.a.Drop_priv,test.a.Reload_priv,test.a.Shutdown_priv,test.a.Process_priv,test.a.File_priv,test.a.Grant_priv,test.a.References_priv,test.a.Index_priv,test.a.Alter_priv,test.a.Show_db_priv,test.a.Super_priv,test.a.Create_tmp_table_priv,test.a.Lock_tables_priv,test.a.Execute_priv,test.a.Repl_slave_priv,test.a.Repl_client_priv,test.a.Create_view_priv,test.a.Show_view_priv,test.a.Create_routine_priv,test.a.Alter_routine_priv,test.a.Create_user_priv,test.a.Event_priv,test.a.Trigger_priv,test.a.Create_tablespace_priv,test.a.Delete_history_priv,test.a.ssl_type,test.a.ssl_cipher,test.a.x509_issuer,test.a.x509_subject,test.a.max_questions,test.a.max_updates,test.a.max_connections,test.a.max_user_connections,test.a.plugin,test.a.authentication_string,test.a.password_expired,test.a.is_role,test.a.default_role,test.a.ma x_statement_time 5 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE a NULL ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE b NULL hash_ALL NULL #hash#$hj 1341 test.a.Host,test.a.User,test.a.Password,test.a.Select_priv,test.a.Insert_priv,test.a.Update_priv,test.a.Delete_priv,test.a.Create_priv,test.a.Drop_priv,test.a.Reload_priv,test.a.Shutdown_priv,test.a.Process_priv,test.a.File_priv,test.a.Grant_priv,test.a.References_priv,test.a.Index_priv,test.a.Alter_priv,test.a.Show_db_priv,test.a.Super_priv,test.a.Create_tmp_table_priv,test.a.Lock_tables_priv,test.a.Execute_priv,test.a.Repl_slave_priv,test.a.Repl_client_priv,test.a.Create_view_priv,test.a.Show_view_priv,test.a.Create_routine_priv,test.a.Alter_routine_priv,test.a.Create_user_priv,test.a.Event_priv,test.a.Trigger_priv,test.a.Create_tablespace_priv,test.a.Delete_history_priv,test.a.ssl_type,test.a.ssl_cipher,test.a.x509_issuer,test.a.x509_subject,test.a.max_questions,test.a.max_updates,test.a.max_connections,test.a.max_user_connections,test.a.plugin,test.a.authentication_string,test.a.password_expired,test.a.is_role,test.a.default_role,test .a.max_statement_time 5 Using where; Using join buffer (flat, BNLH join) DROP TABLE t1,t2,t3; # # End of the test file diff --git a/mysql-test/main/set_operation.result b/mysql-test/main/set_operation.result index c74179afe41..ae4087bc1c9 100644 --- a/mysql-test/main/set_operation.result +++ b/mysql-test/main/set_operation.result @@ -22,11 +22,11 @@ INTERSECT ALL select * from t2 INTERSECT ALL select * from t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 -2 INTERSECT t2 ALL NULL NULL NULL NULL 6 100.00 -3 INTERSECT t3 ALL NULL NULL NULL NULL 5 100.00 -NULL INTERSECT RESULT <intersect1,2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 6 100.00 +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 5 100.00 +NULL INTERSECT RESULT <intersect1,2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` intersect all /* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` intersect all /* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` select * from t1 @@ -46,12 +46,12 @@ INTERSECT ALL select * from t3 INTERSECT select * from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 -2 INTERSECT t2 ALL NULL NULL NULL NULL 6 100.00 -3 INTERSECT t3 ALL NULL NULL NULL NULL 5 100.00 -4 INTERSECT t1 ALL NULL NULL NULL NULL 5 100.00 -NULL INTERSECT RESULT <intersect1,2,3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 6 100.00 +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 5 100.00 +4 INTERSECT t1 NULL ALL NULL NULL NULL NULL 5 100.00 +NULL INTERSECT RESULT <intersect1,2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` intersect /* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` intersect /* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` intersect /* select#4 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` select * from t1 @@ -71,12 +71,12 @@ INTERSECT ALL select * from t3 EXCEPT ALL select * from t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 -2 INTERSECT t2 ALL NULL NULL NULL NULL 6 100.00 -3 INTERSECT t3 ALL NULL NULL NULL NULL 5 100.00 -4 EXCEPT t4 ALL NULL NULL NULL NULL 3 100.00 -NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 6 100.00 +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 5 100.00 +4 EXCEPT t4 NULL ALL NULL NULL NULL NULL 3 100.00 +NULL UNIT RESULT <unit1,2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` intersect all /* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` intersect all /* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` except all /* select#4 */ select `test`.`t4`.`g` AS `g`,`test`.`t4`.`h` AS `h` from `test`.`t4` select * from t1 @@ -91,11 +91,11 @@ INTERSECT select * from t2 EXCEPT ALL select * from t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 -2 INTERSECT t2 ALL NULL NULL NULL NULL 6 100.00 -3 EXCEPT t4 ALL NULL NULL NULL NULL 3 100.00 -NULL UNIT RESULT <unit1,2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 6 100.00 +3 EXCEPT t4 NULL ALL NULL NULL NULL NULL 3 100.00 +NULL UNIT RESULT <unit1,2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` intersect /* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` except /* select#3 */ select `test`.`t4`.`g` AS `g`,`test`.`t4`.`h` AS `h` from `test`.`t4` insert into t4 values (1,1),(9,9); @@ -116,12 +116,12 @@ UNION ALL select * from t3 EXCEPT select * from t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 -2 UNION t2 ALL NULL NULL NULL NULL 6 100.00 -3 UNION t3 ALL NULL NULL NULL NULL 5 100.00 -4 EXCEPT t4 ALL NULL NULL NULL NULL 5 100.00 -NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 +2 UNION t2 NULL ALL NULL NULL NULL NULL 6 100.00 +3 UNION t3 NULL ALL NULL NULL NULL NULL 5 100.00 +4 EXCEPT t4 NULL ALL NULL NULL NULL NULL 5 100.00 +NULL UNIT RESULT <unit1,2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` union /* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` union /* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` except /* select#4 */ select `test`.`t4`.`g` AS `g`,`test`.`t4`.`h` AS `h` from `test`.`t4` delete from t4; @@ -158,15 +158,15 @@ EXCEPT select * from t3 UNION ALL select * from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 -2 INTERSECT t2 ALL NULL NULL NULL NULL 6 100.00 -3 UNION t3 ALL NULL NULL NULL NULL 5 100.00 -4 EXCEPT t1 ALL NULL NULL NULL NULL 5 100.00 -5 UNION t4 ALL NULL NULL NULL NULL 2 100.00 -6 EXCEPT t3 ALL NULL NULL NULL NULL 5 100.00 -7 UNION t1 ALL NULL NULL NULL NULL 5 100.00 -NULL UNIT RESULT <unit1,2,3,4,5,6,7> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 6 100.00 +3 UNION t3 NULL ALL NULL NULL NULL NULL 5 100.00 +4 EXCEPT t1 NULL ALL NULL NULL NULL NULL 5 100.00 +5 UNION t4 NULL ALL NULL NULL NULL NULL 2 100.00 +6 EXCEPT t3 NULL ALL NULL NULL NULL NULL 5 100.00 +7 UNION t1 NULL ALL NULL NULL NULL NULL 5 100.00 +NULL UNIT RESULT <unit1,2,3,4,5,6,7> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` intersect all /* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` union all /* select#3 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` except all /* select#4 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` union /* select#5 */ select `test`.`t4`.`g` AS `g`,`test`.`t4`.`h` AS `h` from `test`.`t4` except /* select#6 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` union all /* select#7 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` drop table t4; @@ -198,28 +198,28 @@ union all (select 9 union all select 10) except all select 11; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived8> ALL NULL NULL NULL NULL 4 100.00 -8 DERIVED <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 EXCEPT NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL NULL -9 UNION <derived5> ALL NULL NULL NULL NULL 2 100.00 -5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -6 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used -7 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL INTERSECT RESULT <intersect5,6,7> ALL NULL NULL NULL NULL NULL NULL -12 EXCEPT <derived10> ALL NULL NULL NULL NULL 2 100.00 -10 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -11 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL INTERSECT RESULT <intersect10,11> ALL NULL NULL NULL NULL NULL NULL -NULL UNIT RESULT <unit8,9,12> ALL NULL NULL NULL NULL NULL NULL -15 UNION <derived13> ALL NULL NULL NULL NULL 2 100.00 -13 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -14 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -16 EXCEPT NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNIT RESULT <unit1,15,16> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived8> NULL ALL NULL NULL NULL NULL 4 100.00 +8 DERIVED <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 EXCEPT NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT <unit2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL +9 UNION <derived5> NULL ALL NULL NULL NULL NULL 2 100.00 +5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +6 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +7 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL INTERSECT RESULT <intersect5,6,7> NULL ALL NULL NULL NULL NULL NULL NULL +12 EXCEPT <derived10> NULL ALL NULL NULL NULL NULL 2 100.00 +10 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +11 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL INTERSECT RESULT <intersect10,11> NULL ALL NULL NULL NULL NULL NULL NULL +NULL UNIT RESULT <unit8,9,12> NULL ALL NULL NULL NULL NULL NULL NULL +15 UNION <derived13> NULL ALL NULL NULL NULL NULL 2 100.00 +13 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +14 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +16 EXCEPT NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT <unit1,15,16> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `__14`.`1` AS `1` from (/* select#8 */ select `__7`.`1` AS `1` from (/* select#2 */ select 1 AS `1` except /* select#3 */ select 5 AS `5` union /* select#4 */ select 6 AS `6`) `__7` union /* select#9 */ select `__8`.`2` AS `2` from (/* select#5 */ select 2 AS `2` intersect /* select#6 */ select 3 AS `3` intersect /* select#7 */ select 4 AS `4`) `__8` except /* select#12 */ select `__11`.`7` AS `7` from (/* select#10 */ select 7 AS `7` intersect /* select#11 */ select 8 AS `8`) `__11`) `__14` union all /* select#15 */ select `__15`.`9` AS `9` from (/* select#13 */ select 9 AS `9` union all /* select#14 */ select 10 AS `10`) `__15` except all /* select#16 */ select 11 AS `11` (select 1 union all select 2) @@ -233,14 +233,14 @@ union EXPLAIN EXTENDED (select 1 union all select 2) union (select 3 union all select 4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -6 UNION <derived4> ALL NULL NULL NULL NULL 2 100.00 -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -5 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +6 UNION <derived4> NULL ALL NULL NULL NULL NULL 2 100.00 +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +5 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,6> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `__5`.`1` AS `1` from (/* select#2 */ select 1 AS `1` union /* select#3 */ select 2 AS `2`) `__5` union /* select#6 */ select `__6`.`3` AS `3` from (/* select#4 */ select 3 AS `3` union /* select#5 */ select 4 AS `4`) `__6` (select 1 intersect all select 2) @@ -250,13 +250,13 @@ select 3; EXPLAIN EXTENDED (select 1 intersect all select 2) except select 3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL NULL -4 EXCEPT NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL EXCEPT RESULT <except1,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL NULL NULL NULL NULL NULL +4 EXCEPT NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL EXCEPT RESULT <except1,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `__4`.`1` AS `1` from (/* select#2 */ select 1 AS `1` intersect /* select#3 */ select 2 AS `2`) `__4` except /* select#4 */ select 3 AS `3` (select 1 intersect all select 2 intersect all select 3) @@ -266,17 +266,17 @@ intersect EXPLAIN EXTENDED (select 1 intersect all select 2 intersect all select 3) intersect (select 4 intersect all select 5); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL INTERSECT RESULT <intersect2,3,4> ALL NULL NULL NULL NULL NULL NULL -7 INTERSECT <derived5> ALL NULL NULL NULL NULL 2 100.00 -5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -6 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL INTERSECT RESULT <intersect5,6> ALL NULL NULL NULL NULL NULL NULL -NULL INTERSECT RESULT <intersect1,7> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL INTERSECT RESULT <intersect2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL +7 INTERSECT <derived5> NULL ALL NULL NULL NULL NULL 2 100.00 +5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +6 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL INTERSECT RESULT <intersect5,6> NULL ALL NULL NULL NULL NULL NULL NULL +NULL INTERSECT RESULT <intersect1,7> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `__6`.`1` AS `1` from (/* select#2 */ select 1 AS `1` intersect /* select#3 */ select 2 AS `2` intersect /* select#4 */ select 3 AS `3`) `__6` intersect /* select#7 */ select `__7`.`4` AS `4` from (/* select#5 */ select 4 AS `4` intersect /* select#6 */ select 5 AS `5`) `__7` # test set operations with table value constructor @@ -523,24 +523,24 @@ UNION ALL select * from v0 where g < 4 UNION ALL select * from t3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 -8 UNION <derived2> ALL NULL NULL NULL NULL 5 -2 DERIVED t2 ALL NULL NULL NULL NULL 6 -3 INTERSECT NULL NULL NULL NULL NULL NULL NULL No tables used -4 INTERSECT <derived5> ALL NULL NULL NULL NULL 10 -5 DERIVED t1 ALL NULL NULL NULL NULL 5 -6 UNION t1 ALL NULL NULL NULL NULL 5 -NULL INTERSECT RESULT <intersect2,3,4> ALL NULL NULL NULL NULL NULL -7 EXCEPT t3 ALL NULL NULL NULL NULL 5 -9 UNION t2 ALL NULL NULL NULL NULL 6 -10 UNION t3 ALL NULL NULL NULL NULL 5 -11 EXCEPT t1 ALL NULL NULL NULL NULL 5 -11 EXCEPT t2 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) -12 UNION t1 ALL NULL NULL NULL NULL 5 Using where -12 UNION t2 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) -13 UNION t3 ALL NULL NULL NULL NULL 5 -NULL UNIT RESULT <unit1,8,7,9,10,11,12,13> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 +8 UNION <derived2> NULL ALL NULL NULL NULL NULL 5 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 +3 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 INTERSECT <derived5> NULL ALL NULL NULL NULL NULL 10 +5 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 +6 UNION t1 NULL ALL NULL NULL NULL NULL 5 +NULL INTERSECT RESULT <intersect2,3,4> NULL ALL NULL NULL NULL NULL NULL +7 EXCEPT t3 NULL ALL NULL NULL NULL NULL 5 +9 UNION t2 NULL ALL NULL NULL NULL NULL 6 +10 UNION t3 NULL ALL NULL NULL NULL NULL 5 +11 EXCEPT t1 NULL ALL NULL NULL NULL NULL 5 +11 EXCEPT t2 NULL ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) +12 UNION t1 NULL ALL NULL NULL NULL NULL 5 Using where +12 UNION t2 NULL ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) +13 UNION t3 NULL ALL NULL NULL NULL NULL 5 +NULL UNIT RESULT <unit1,8,7,9,10,11,12,13> NULL ALL NULL NULL NULL NULL NULL EXPLAIN format=json select * from t1 UNION ALL @@ -837,24 +837,24 @@ UNION ALL select * from v0 where g < 4 UNION ALL select * from t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 -8 UNION <derived2> ALL NULL NULL NULL NULL 5 100.00 -2 DERIVED t2 ALL NULL NULL NULL NULL 6 100.00 -3 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 INTERSECT <derived5> ALL NULL NULL NULL NULL 10 100.00 -5 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 -6 UNION t1 ALL NULL NULL NULL NULL 5 100.00 -NULL INTERSECT RESULT <intersect2,3,4> ALL NULL NULL NULL NULL NULL NULL -7 EXCEPT t3 ALL NULL NULL NULL NULL 5 100.00 -9 UNION t2 ALL NULL NULL NULL NULL 6 100.00 -10 UNION t3 ALL NULL NULL NULL NULL 5 100.00 -11 EXCEPT t1 ALL NULL NULL NULL NULL 5 100.00 -11 EXCEPT t2 ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join) -12 UNION t1 ALL NULL NULL NULL NULL 5 100.00 Using where -12 UNION t2 ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join) -13 UNION t3 ALL NULL NULL NULL NULL 5 100.00 -NULL UNIT RESULT <unit1,8,7,9,10,11,12,13> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 +8 UNION <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 100.00 +3 INTERSECT NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 INTERSECT <derived5> NULL ALL NULL NULL NULL NULL 10 100.00 +5 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 +6 UNION t1 NULL ALL NULL NULL NULL NULL 5 100.00 +NULL INTERSECT RESULT <intersect2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL +7 EXCEPT t3 NULL ALL NULL NULL NULL NULL 5 100.00 +9 UNION t2 NULL ALL NULL NULL NULL NULL 6 100.00 +10 UNION t3 NULL ALL NULL NULL NULL NULL 5 100.00 +11 EXCEPT t1 NULL ALL NULL NULL NULL NULL 5 100.00 +11 EXCEPT t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join) +12 UNION t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +12 UNION t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join) +13 UNION t3 NULL ALL NULL NULL NULL NULL 5 100.00 +NULL UNIT RESULT <unit1,8,7,9,10,11,12,13> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` union all /* select#8 */ select `__8`.`c` AS `c`,`__8`.`d` AS `d` from (/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` intersect all (values (1,1),(2,2),(2,2),(5,5),(2,2)) intersect all /* select#4 */ select `sq`.`a` AS `a`,`sq`.`b` AS `b` from (/* select#5 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` union all /* select#6 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) `sq`) `__8` except all /* select#7 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` union /* select#9 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` union /* select#10 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` except /* select#11 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` union all /* select#12 */ select `te st`.`t1`.`a` AS `g`,`test`.`t2`.`c` AS `h` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` < 4 union all /* select#13 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3` PREPARE stmt from" diff --git a/mysql-test/main/set_operation_oracle.result b/mysql-test/main/set_operation_oracle.result index 947e5e9a11c..38047f32c08 100644 --- a/mysql-test/main/set_operation_oracle.result +++ b/mysql-test/main/set_operation_oracle.result @@ -11,12 +11,12 @@ a b 3 3 explain extended (select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 UNION t2 ALL NULL NULL NULL NULL 2 100.00 -3 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00 -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 UNION t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 2 100.00 +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT <unit1,2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1") union (/* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2") intersect (/* select#3 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3") union (/* select#4 */ select 4 AS "4",4 AS "4") (select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4); @@ -27,12 +27,12 @@ e f 4 4 explain extended (select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 -2 INTERSECT t2 ALL NULL NULL NULL NULL 2 100.00 -3 UNION t1 ALL NULL NULL NULL NULL 2 100.00 -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT <unit1,2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3") intersect (/* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2") union (/* select#3 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1") union (/* select#4 */ select 4 AS "4",4 AS "4") create table t12(c1 int); @@ -65,12 +65,12 @@ a b 3 3 explain extended select a,b from t1 union all select c,d from t2 intersect select e,f from t3 union all select 4,'4' from dual; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 UNION t2 ALL NULL NULL NULL NULL 2 100.00 -3 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00 -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 UNION t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 2 100.00 +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT <unit1,2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1" union all /* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2" intersect /* select#3 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3" union all /* select#4 */ select 4 AS "4",'4' AS "4" select a,b from t1 union all select c,d from t2 intersect all select e,f from t3 union all select 4,'4' from dual; @@ -79,12 +79,12 @@ a b 4 4 explain extended select a,b from t1 union all select c,d from t2 intersect all select e,f from t3 union all select 4,'4' from dual; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 UNION t2 ALL NULL NULL NULL NULL 2 100.00 -3 INTERSECT t3 ALL NULL NULL NULL NULL 2 100.00 -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 UNION t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 INTERSECT t3 NULL ALL NULL NULL NULL NULL 2 100.00 +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT <unit1,2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1" union all /* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2" intersect all /* select#3 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3" union all /* select#4 */ select 4 AS "4",'4' AS "4" select e,f from t3 intersect select c,d from t2 union all select a,b from t1 union all select 4,'4' from dual; @@ -95,12 +95,12 @@ e f 4 4 explain extended select e,f from t3 intersect select c,d from t2 union all select a,b from t1 union all select 4,'4' from dual; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 -2 INTERSECT t2 ALL NULL NULL NULL NULL 2 100.00 -3 UNION t1 ALL NULL NULL NULL NULL 2 100.00 -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT <unit1,2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3" intersect /* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2" union all /* select#3 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1" union all /* select#4 */ select 4 AS "4",'4' AS "4" select e,f from t3 intersect all select c,d from t2 union all select a,b from t1 union all select 4,'4' from dual; @@ -111,12 +111,12 @@ e f 4 4 explain extended select e,f from t3 intersect all select c,d from t2 union all select a,b from t1 union all select 4,'4' from dual; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 -2 INTERSECT t2 ALL NULL NULL NULL NULL 2 100.00 -3 UNION t1 ALL NULL NULL NULL NULL 2 100.00 -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNIT RESULT <unit1,2,3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 +2 INTERSECT t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT <unit1,2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select "test"."t3"."e" AS "e","test"."t3"."f" AS "f" from "test"."t3" intersect all /* select#2 */ select "test"."t2"."c" AS "c","test"."t2"."d" AS "d" from "test"."t2" union all /* select#3 */ select "test"."t1"."a" AS "a","test"."t1"."b" AS "b" from "test"."t1" union all /* select#4 */ select 4 AS "4",'4' AS "4" set SQL_MODE=default; diff --git a/mysql-test/main/set_statement.result b/mysql-test/main/set_statement.result index 97cc4f3831a..4cf3f85c386 100644 --- a/mysql-test/main/set_statement.result +++ b/mysql-test/main/set_statement.result @@ -1219,8 +1219,8 @@ WEEK('2000-01-01') create table t1 (a date); insert t1 values ('2000-01-01'); explain extended select week(a) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select week('2000-01-01') AS `week(a)` from dual prepare stmt1 from "select week(a) from t1"; @@ -1247,13 +1247,13 @@ set statement OLD_PASSWORDS = 1 for select password('test'); password('test') 378b243e220ca493 set statement OLD_PASSWORDS = 0 for explain extended select password('test'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select password('test') AS `password('test')` set statement OLD_PASSWORDS = 1 for explain extended select password('test'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select password('test') AS `password('test')` create table t1 (a char(10)); diff --git a/mysql-test/main/show_analyze.result b/mysql-test/main/show_analyze.result index e307edcccf8..cdb2720d317 100644 --- a/mysql-test/main/show_analyze.result +++ b/mysql-test/main/show_analyze.result @@ -30,8 +30,8 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; select count(*) from t1 where c < 500; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 50.00 50.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 1000.00 50.00 50.00 Using where Warnings: Note 1003 select count(*) from t1 where c < 500 connection con1; @@ -40,8 +40,8 @@ count(*) select max(c) from t1 where c < 10; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 10.00 10.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 1000.00 10.00 10.00 Using where Warnings: Note 1003 select max(c) from t1 where c < 10 connection con1; @@ -51,13 +51,13 @@ max(c) analyze select max(c) from t1 where a < 10; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL a NULL NULL NULL 1000 1000.00 99.90 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 1000 1000.00 99.90 100.00 Using where Warnings: Note 1003 analyze select max(c) from t1 where a < 10 connection con1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL a NULL NULL NULL 1000 1000.00 99.90 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 1000 1000.00 99.90 100.00 Using where SET debug_dbug=@old_debug; # UNION, select, first branch set @show_explain_probe_select_id=1; @@ -65,10 +65,10 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where -2 UNION B ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where +2 UNION B NULL ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL 0.00 NULL NULL Warnings: Note 1003 select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9 connection con1; @@ -81,10 +81,10 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where -2 UNION B ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where +2 UNION B NULL ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL 0.00 NULL NULL Warnings: Note 1003 select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9 connection con1; @@ -97,33 +97,33 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where -2 UNION B ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where +2 UNION B NULL ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL 0.00 NULL NULL Warnings: Note 1003 analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9 connection con1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where -2 UNION B ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 7.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where +2 UNION B NULL ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL 7.00 NULL NULL # UNION, analyze, second branch set @show_explain_probe_select_id=2; analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where -2 UNION B ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where +2 UNION B NULL ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL 0.00 NULL NULL Warnings: Note 1003 analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9 connection con1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where -2 UNION B ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 7.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where +2 UNION B NULL ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL 7.00 NULL NULL SET debug_dbug=@old_debug; # Uncorrelated subquery, select set @show_explain_probe_select_id=1; @@ -131,9 +131,9 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; select a, (select max(a) from t0 B where a>6) from t0 A where a<2; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where -2 SUBQUERY B ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where Warnings: Note 1003 select a, (select max(a) from t0 B where a>6) from t0 A where a<2 connection con1; @@ -147,15 +147,15 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; analyze select a, (select max(a) from t0 B where a>6) from t0 A where a<2; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where -2 SUBQUERY B ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where Warnings: Note 1003 analyze select a, (select max(a) from t0 B where a>6) from t0 A where a<2 connection con1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where -2 SUBQUERY B ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where SET debug_dbug=@old_debug; # correlated subquery, select, before execution start set @show_explain_probe_select_id=1; @@ -163,9 +163,9 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where -2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where Warnings: Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2 connection con1; @@ -179,9 +179,9 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where -2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 10.00 100.00 95.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 10.00 100.00 95.00 Using where Warnings: Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2 connection con1; @@ -195,15 +195,15 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; analyze select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where -2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 10.00 100.00 95.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 10.00 100.00 95.00 Using where Warnings: Note 1003 analyze select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2 connection con1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where -2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 10.00 100.00 95.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 10.00 100.00 95.00 Using where SET debug_dbug=@old_debug; # Try to do SHOW ANALYZE for a query that runs a SET command: # @@ -226,15 +226,15 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 1.00 100.00 0.00 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 1.00 100.00 0.00 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where Warnings: Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 2.00 100.00 0.00 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 2.00 100.00 0.00 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where Warnings: Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 connection con1; @@ -249,15 +249,15 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 1.00 100.00 0.00 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 1.00 100.00 0.00 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where Warnings: Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 2.00 100.00 0.00 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 2.00 100.00 0.00 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where Warnings: Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 connection con1; @@ -272,21 +272,21 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 1.00 100.00 100.00 -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 1.00 100.00 100.00 +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 2.00 100.00 100.00 -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 2.00 100.00 100.00 +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 10.00 100.00 25.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 3.00 100.00 100.00 +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 25.00 Using where Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 connection con1; @@ -304,8 +304,8 @@ set @show_explain_probe_select_id=1; select * from t0 order by a; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using filesort Warnings: Note 1003 select * from t0 order by a connection con1; @@ -330,8 +330,8 @@ set @show_explain_probe_select_id=1; select distinct a from t0; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using temporary Warnings: Note 1003 select distinct a from t0 connection con1; @@ -355,8 +355,8 @@ set @show_explain_probe_select_id=1; select distinct a from t0; connection default; show analyze for $thr2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using temporary Warnings: Note 1003 select distinct a from t0 connection con1; diff --git a/mysql-test/main/show_analyze_json.result b/mysql-test/main/show_analyze_json.result index 574fe73f20c..df91060b286 100644 --- a/mysql-test/main/show_analyze_json.result +++ b/mysql-test/main/show_analyze_json.result @@ -126,8 +126,8 @@ SHOW ANALYZE Warnings: Note 1003 analyze select max(c) from t1 where a < 10 connection con1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL a NULL NULL NULL 1000 1000.00 99.90 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 1000 1000.00 99.90 100.00 Using where SET debug_dbug=@old_debug; # UNION, select, first branch set @show_explain_probe_select_id=1; @@ -328,10 +328,10 @@ SHOW ANALYZE Warnings: Note 1003 analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9 connection con1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where -2 UNION b ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 7.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where +2 UNION b NULL ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL 7.00 NULL NULL # UNION, analyze, second branch set @show_explain_probe_select_id=2; analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9; @@ -401,10 +401,10 @@ SHOW ANALYZE Warnings: Note 1003 analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9 connection con1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where -2 UNION b ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 7.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where +2 UNION b NULL ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL 7.00 NULL NULL SET debug_dbug=@old_debug; # Uncorrelated subquery, select set @show_explain_probe_select_id=1; @@ -522,9 +522,9 @@ SHOW ANALYZE Warnings: Note 1003 analyze select a, (select max(a) from t0 b where a>6) from t0 a where a<2 connection con1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where -2 SUBQUERY b ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where +2 SUBQUERY b NULL ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where SET debug_dbug=@old_debug; # correlated subquery, select, before execution start set @show_explain_probe_select_id=1; @@ -709,9 +709,9 @@ SHOW ANALYZE Warnings: Note 1003 analyze select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2 connection con1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where -2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 10.00 100.00 95.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 10.00 100.00 95.00 Using where SET debug_dbug=@old_debug; # Try to do SHOW ANALYZE for a query that runs a SET command: # diff --git a/mysql-test/main/show_analyze_partition.result b/mysql-test/main/show_analyze_partition.result new file mode 100644 index 00000000000..a7234b500cd --- /dev/null +++ b/mysql-test/main/show_analyze_partition.result @@ -0,0 +1,39 @@ +drop table if exists t0, t1, t2, t3, t4; +drop view if exists v1; +SET @old_debug= @@session.debug; +connect con1, localhost, root,,; +connection con1; +SET @old_debug= @@session.debug; +connection default; +create table t1 (a int) partition by hash(a) partitions 4; +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +connection con1; +set @show_explain_probe_select_id=1; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; +select count(*) from t1 where a in (1,2); +connection default; +# The point of this test: see that `partitions` column has correct info: +show analyze for $thr2; +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 5 5.00 100.00 40.00 Using where +Warnings: +Note 1003 select count(*) from t1 where a in (1,2) +connection con1; +count(*) +2 +select count(*) from t1 where a in (1,2); +connection default; +# The point of this test: see that `partitions` column has correct info: +show explain for $thr2; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 5 Using where +Warnings: +Note 1003 select count(*) from t1 where a in (1,2) +connection con1; +count(*) +2 +connection default; +SET debug_dbug=@old_debug; +disconnect con1; +set debug_sync='RESET'; +drop table t1; diff --git a/mysql-test/main/show_analyze_partition.test b/mysql-test/main/show_analyze_partition.test new file mode 100644 index 00000000000..04002c2d783 --- /dev/null +++ b/mysql-test/main/show_analyze_partition.test @@ -0,0 +1,60 @@ + +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/not_embedded.inc +--source include/have_partition.inc + +# Using valgrind can cause 'reap' to fail. See comment below +--source include/not_valgrind.inc + +--disable_warnings +drop table if exists t0, t1, t2, t3, t4; +drop view if exists v1; +--enable_warnings +SET @old_debug= @@session.debug; + +# +# Setup two threads and their ids +# +let $thr1=`select connection_id()`; +connect (con1, localhost, root,,); +connection con1; +let $thr2=`select connection_id()`; +SET @old_debug= @@session.debug; +connection default; + +let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2; + +create table t1 (a int) partition by hash(a) partitions 4; +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +connection con1; +set @show_explain_probe_select_id=1; +SET debug_dbug='+d,show_explain_probe_join_exec_end'; +send select count(*) from t1 where a in (1,2); + +connection default; +--source include/wait_condition.inc +--echo # The point of this test: see that `partitions` column has correct info: +evalp show analyze for $thr2; +connection con1; +reap; + +send select count(*) from t1 where a in (1,2); + + +connection default; +--source include/wait_condition.inc +--echo # The point of this test: see that `partitions` column has correct info: +evalp show explain for $thr2; +connection con1; +reap; + + +connection default; +SET debug_dbug=@old_debug; +disconnect con1; +set debug_sync='RESET'; + +drop table t1; + diff --git a/mysql-test/main/show_explain.result b/mysql-test/main/show_explain.result index 345fa928601..d5c2e33106f 100644 --- a/mysql-test/main/show_explain.result +++ b/mysql-test/main/show_explain.result @@ -39,8 +39,8 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select count(*) from t1 where a < 100000; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 999 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 999 Using where; Using index Warnings: Note 1003 select count(*) from t1 where a < 100000 connection con1; @@ -49,8 +49,8 @@ count(*) select max(c) from t1 where a < 10; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 10 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 Using index condition Warnings: Note 1003 select max(c) from t1 where a < 10 connection con1; @@ -59,8 +59,8 @@ max(c) select max(c) from t1 where a < 10; connection default; explain for connection $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 10 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 Using index condition Warnings: Note 1003 select max(c) from t1 where a < 10 connection con1; @@ -72,24 +72,24 @@ set optimizer_switch='index_condition_pushdown=on,mrr=on,mrr_sort_keys=on'; explain select max(c) from t1 where a < 10; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 Using index condition; Rowid-ordered scan Warnings: Note 1003 explain select max(c) from t1 where a < 10 connection con1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 Using index condition; Rowid-ordered scan # Same for EXPLAIN FOR CONNECTION explain select max(c) from t1 where a < 10; connection default; explain for connection $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 Using index condition; Rowid-ordered scan Warnings: Note 1003 explain select max(c) from t1 where a < 10 connection con1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 Using index condition; Rowid-ordered scan set optimizer_switch= @show_expl_tmp; SET debug_dbug=@old_debug; # UNION, first branch @@ -98,17 +98,17 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; explain select a from t0 A union select a+1 from t0 B; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 -2 UNION B ALL NULL NULL NULL NULL 10 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 +2 UNION B NULL ALL NULL NULL NULL NULL 10 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL Warnings: Note 1003 explain select a from t0 A union select a+1 from t0 B connection con1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 -2 UNION B ALL NULL NULL NULL NULL 10 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 +2 UNION B NULL ALL NULL NULL NULL NULL 10 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL SET debug_dbug=@old_debug; # UNION, second branch set @show_explain_probe_select_id=2; @@ -116,17 +116,17 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; explain select a from t0 A union select a+1 from t0 B; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 -2 UNION B ALL NULL NULL NULL NULL 10 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 +2 UNION B NULL ALL NULL NULL NULL NULL 10 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL Warnings: Note 1003 explain select a from t0 A union select a+1 from t0 B connection con1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 -2 UNION B ALL NULL NULL NULL NULL 10 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 +2 UNION B NULL ALL NULL NULL NULL NULL 10 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL SET debug_dbug=@old_debug; # Uncorrelated subquery, select set @show_explain_probe_select_id=1; @@ -134,9 +134,9 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 B) from t0 A where a<1; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where -2 SUBQUERY B ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 Warnings: Note 1003 select a, (select max(a) from t0 B) from t0 A where a<1 connection con1; @@ -149,15 +149,15 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; explain select a, (select max(a) from t0 B) from t0 A where a<1; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where -2 SUBQUERY B ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 Warnings: Note 1003 explain select a, (select max(a) from t0 B) from t0 A where a<1 connection con1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where -2 SUBQUERY B ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 SET debug_dbug=@old_debug; # correlated subquery, select set @show_explain_probe_select_id=1; @@ -165,9 +165,9 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1 connection con1; @@ -180,15 +180,15 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; explain select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 explain select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1 connection con1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 Using where SET debug_dbug=@old_debug; # correlated subquery, select, while inside the subquery set @show_explain_probe_select_id=2; @@ -196,9 +196,9 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1 connection con1; @@ -211,9 +211,9 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1 connection con1; @@ -226,9 +226,9 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1 connection con1; @@ -257,15 +257,15 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 connection con1; @@ -277,15 +277,15 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; explain for connection $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 explain for connection $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 connection con1; @@ -300,15 +300,15 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 connection con1; @@ -323,15 +323,15 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ; connection default; explain for connection $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 explain for connection $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 connection con1; @@ -346,21 +346,21 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 connection con1; @@ -379,21 +379,21 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2; connection default; explain for connection $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 explain for connection $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 explain for connection $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2 connection con1; @@ -407,15 +407,15 @@ SET debug_dbug=@old_debug; # SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort" # explain select * from t0 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using filesort SET debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; select * from t0 order by a; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using filesort Warnings: Note 1003 select * from t0 order by a connection con1; @@ -436,16 +436,16 @@ SET debug_dbug=@old_debug; # connection default; explain select distinct a from t0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using temporary connection con1; SET debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; select distinct a from t0; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using temporary Warnings: Note 1003 select distinct a from t0 connection con1; @@ -466,16 +466,16 @@ SET debug_dbug=@old_debug; # connection default; explain select distinct a from t0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using temporary connection con1; SET debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; select distinct a from t0; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using temporary Warnings: Note 1003 select distinct a from t0 connection con1; @@ -497,18 +497,18 @@ SET debug_dbug=@old_debug; CREATE TABLE t2 ( a INT ); INSERT INTO t2 VALUES (1),(2),(1),(4),(2); explain SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) SET debug_dbug='+d,show_explain_in_find_all_keys'; SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a; connection default; # FIXED by "conservative assumptions about when QEP is available" fix: # NOTE: current code will not show "Using join buffer": show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) Warnings: Note 1003 SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a connection con1; @@ -525,9 +525,9 @@ DROP TABLE t2; CREATE TABLE t2 (a INT); INSERT INTO t2 VALUES (1),(2),(1),(4),(2); EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a` set @show_explain_probe_select_id=1; @@ -535,15 +535,15 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) Warnings: Note 1003 EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a connection con1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a` SET debug_dbug=@old_debug; @@ -558,10 +558,10 @@ INSERT INTO t3 VALUES (8); CREATE TABLE t2 (b INT); INSERT INTO t2 VALUES (4),(5),(6),(7),(8),(9); explain SELECT * FROM v1, t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 6 -2 DERIVED t3 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 6 +2 DERIVED t3 NULL system NULL NULL NULL NULL 1 set @show_explain_probe_select_id=2; SET debug_dbug='+d,show_explain_probe_join_exec_end'; SELECT * FROM v1, t2; @@ -582,8 +582,8 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; select sleep(1); connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select sleep(1) connection con1; @@ -598,8 +598,8 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; select * from t0 where 1>10; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select * from t0 where 1>10 connection con1; @@ -615,8 +615,8 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; select * from t0,t3 where t3.a=112233; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 select * from t0,t3 where t3.a=112233 connection con1; @@ -635,10 +635,10 @@ explain SELECT * FROM t2 WHERE a = (SELECT MAX(a) FROM t2 WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 20 Using where -2 SUBQUERY t2 const PRIMARY PRIMARY 4 const 1 -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 Using where +2 SUBQUERY t2 NULL const PRIMARY PRIMARY 4 const 1 +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_do_select'; SELECT * FROM t2 WHERE a = @@ -647,10 +647,10 @@ WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3) ); connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 20 Using where -2 SUBQUERY t2 const PRIMARY PRIMARY 4 const 1 -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 Using where +2 SUBQUERY t2 NULL const PRIMARY PRIMARY 4 const 1 +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 SELECT * FROM t2 WHERE a = (SELECT MAX(a) FROM t2 @@ -689,10 +689,10 @@ WHERE a1 < ALL ( SELECT a1 FROM t2 WHERE a1 IN ( SELECT a1 FROM t2, t4 ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index NULL a1 5 NULL 20 Using where; Using index -1 PRIMARY t3 ALL NULL NULL NULL NULL 87 Using join buffer (flat, BNL join) -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index NULL a1 5 NULL 20 Using where; Using index +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 87 Using join buffer (flat, BNL join) +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_do_select'; SELECT count(*) FROM t2, t3 @@ -702,10 +702,10 @@ WHERE a1 IN ( SELECT a1 FROM t2, t4 ) ); connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index NULL a1 5 NULL 20 Using where; Using index -1 PRIMARY t3 ALL NULL NULL NULL NULL 87 Using join buffer (flat, BNL join) -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index NULL a1 5 NULL 20 Using where; Using index +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 87 Using join buffer (flat, BNL join) +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 SELECT count(*) FROM t2, t3 WHERE a1 < ALL ( @@ -729,10 +729,10 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end'; SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`); connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> const distinct_key distinct_key 8 const,const 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) -2 MATERIALIZED t2 index NULL a1 4 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL const distinct_key distinct_key 8 const,const 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL index NULL a1 4 NULL 20 Using index Warnings: Note 1003 SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`) connection con1; @@ -750,8 +750,8 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT 'test' FROM t1 WHERE a=1; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 5 const 2 Using index Warnings: Note 1003 SELECT 'test' FROM t1 WHERE a=1 connection con1; @@ -772,35 +772,35 @@ update t1 set col1=3, col2=1000 where key1=4; set @tmp_mdev299_jcl= @@join_cache_level; set join_cache_level=0; explain select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where -1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE B NULL ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1) set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_test_if_quick_select'; select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where -1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE B NULL ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1) Warnings: Note 1003 select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100 show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where -1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE B NULL ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1) Warnings: Note 1003 select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100 show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where -1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE B NULL ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1) Warnings: Note 1003 select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100 show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where -1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE B NULL ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1) Warnings: Note 1003 select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100 connection con1; @@ -819,8 +819,8 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; SHOW INDEX FROM t1; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE STATISTICS ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL Open_full_table; Scanned 0 databases +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE STATISTICS NULL ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL Open_full_table; Scanned 0 databases Warnings: Note 1003 SHOW INDEX FROM t1 connection con1; @@ -838,17 +838,17 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2); CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; EXPLAIN SELECT a + 1 FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 SET debug_dbug='+d,show_explain_probe_join_tab_preread'; set @show_explain_probe_select_id=1; SELECT a + 1 FROM v1; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 Warnings: Note 1003 SELECT a + 1 FROM v1 connection con1; @@ -866,28 +866,28 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (4),(6); EXPLAIN SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SET debug_dbug='+d,show_explain_probe_union_read'; SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 ); connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL Warnings: Note 1003 SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 ) show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL Warnings: Note 1003 SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 ) connection con1; @@ -909,22 +909,22 @@ INSERT INTO t2 VALUES EXPLAIN SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 20 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 20 -3 SUBQUERY t1 ALL NULL NULL NULL NULL 20 -3 SUBQUERY t2 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 20 +3 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 20 Using where set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b ); connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 20 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 20 -3 SUBQUERY t1 ALL NULL NULL NULL NULL 20 -3 SUBQUERY t2 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 20 +3 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 20 Using where Warnings: Note 1003 SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b ) @@ -948,17 +948,17 @@ insert into t3 select * from t4; insert into t4 select * from t3; insert into t3 select * from t4; explain select distinct t1.a from t1,t3 where t1.a=t3.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary -1 SIMPLE t3 ref a a 5 test.t1.a 7 Using index; Distinct +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary +1 SIMPLE t3 NULL ref a a 5 test.t1.a 7 Using index; Distinct set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_start'; select distinct t1.a from t1,t3 where t1.a=t3.a; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary -1 SIMPLE t3 ref a a 5 test.t1.a 7 Using index; Distinct +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary +1 SIMPLE t3 NULL ref a a 5 test.t1.a 7 Using index; Distinct Warnings: Note 1003 select distinct t1.a from t1,t3 where t1.a=t3.a connection con1; @@ -987,8 +987,8 @@ show explain for $thr2; ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select * from t0 where a < 3 connection con1; @@ -1008,8 +1008,8 @@ select * from t0 where a < 3; connection con1; connection con3; show explain for $thr_con2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select * from t0 where a < 3 connection con2; @@ -1033,8 +1033,8 @@ select * from t0 where a < 3; connection default; connection con2; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select * from t0 where a < 3 connection con1; @@ -1116,8 +1116,8 @@ EXPLAIN SELECT a+SLEEP(0.01) FROM t1 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 ORDER BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using temporary; Using filesort set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT a+SLEEP(0.01) FROM t1 @@ -1125,8 +1125,8 @@ WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 ORDER BY b; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using temporary; Using filesort Warnings: Note 1003 SELECT a+SLEEP(0.01) FROM t1 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 @@ -1148,8 +1148,8 @@ WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 ORDER BY b; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using temporary; Using filesort Warnings: Note 1003 SELECT a+SLEEP(0.01) FROM t1 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 @@ -1174,15 +1174,15 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9), (10),(11),(12),(13),(14),(15),(16); INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12, t1 t13; EXPLAIN SELECT a FROM t1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4112 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4112 Using temporary; Using filesort set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT a FROM t1 GROUP BY a; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4112 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4112 Using temporary; Using filesort Warnings: Note 1003 SELECT a FROM t1 GROUP BY a connection con1; @@ -1213,17 +1213,17 @@ INSERT INTO t1 VALUES (3989,'Abilene'),(3873,'Akron'); CREATE TABLE t2 (c INT, d VARCHAR(52) PRIMARY KEY, KEY(c)) ENGINE=InnoDB; INSERT INTO t2 VALUES (86,'English'),(87,'Russian'); explain SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's'; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 index_subquery PRIMARY,c c 5 func 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL index_subquery PRIMARY,c c 5 func 1 Using index; Using where set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's'; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 index_subquery PRIMARY,c c 5 func 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL index_subquery PRIMARY,c c 5 func 1 Using index; Using where Warnings: Note 1003 SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's' connection con1; @@ -1262,19 +1262,19 @@ INSERT INTO t3 VALUES ('ESP','Spanish'),('FRA','French'),('VNM','Vietnamese'); explain SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 -1 SIMPLE t1 range b b 6 NULL 107 Using where; Using index -1 SIMPLE t3 ref PRIMARY PRIMARY 5 test.t1.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t1 NULL range b b 6 NULL 107 Using where; Using index +1 SIMPLE t3 NULL ref PRIMARY PRIMARY 5 test.t1.b 1 Using index set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_do_select'; SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 1 -1 SIMPLE t1 range b b 6 NULL 107 Using where; Using index -1 SIMPLE t3 ref PRIMARY PRIMARY 5 test.t1.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t1 NULL range b b 6 NULL 107 Using where; Using index +1 SIMPLE t3 NULL ref PRIMARY PRIMARY 5 test.t1.b 1 Using index Warnings: Note 1003 SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2 connection con1; @@ -1295,20 +1295,20 @@ insert into t3 select * from t2; explain SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 -1 PRIMARY t2 ALL NULL NULL NULL NULL 20 -3 SUBQUERY t3 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 14 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 20 Using where set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 14 -1 PRIMARY t2 ALL NULL NULL NULL NULL 20 -3 SUBQUERY t3 ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 14 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 20 Using where Warnings: Note 1003 SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10 @@ -1326,9 +1326,9 @@ CREATE TABLE t2 (b INT); INSERT INTO t2 VALUES (8),(9); EXPLAIN SELECT * FROM t1 WHERE ( 8, 89 ) IN ( SELECT b, SUM( DISTINCT b ) FROM t2 GROUP BY b ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using filesort DROP TABLE t1,t2; # # Check if queries in non-default charsets work. @@ -1346,8 +1346,8 @@ select * from t0 where length(' connection default; set names utf8; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select * from t0 where length('гы') = a set names default; @@ -1374,11 +1374,11 @@ SELECT SUM(b) FROM ( SELECT * FROM t1 ) AS alias1, t2 WHERE b <= ANY ( SELECT a FROM t1 WHERE a = b + SLEEP(0.2) OR a >= ( SELECT SUM(b) FROM t2 )); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 4 NULL 2 Using index -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT SUBQUERY t1 ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1) -4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 Using index +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT SUBQUERY t1 NULL ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1) +4 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 set @show_explain_probe_select_id=1; SET debug_dbug='+d,show_explain_probe_join_exec_start'; SELECT SUM(b) FROM ( SELECT * FROM t1 ) AS alias1, t2 @@ -1387,11 +1387,11 @@ SELECT a FROM t1 WHERE a = b + SLEEP(0.2) OR a >= ( SELECT SUM(b) FROM t2 )); connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 4 NULL 2 Using index -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT SUBQUERY t1 ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1) -4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 Using index +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT SUBQUERY t1 NULL ALL a NULL NULL NULL 2 Range checked for each record (index map: 0x1) +4 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Warnings: Note 1003 SELECT SUM(b) FROM ( SELECT * FROM t1 ) AS alias1, t2 WHERE b <= ANY ( diff --git a/mysql-test/main/show_explain_json.result b/mysql-test/main/show_explain_json.result index 191b41cea01..fb70dab1873 100644 --- a/mysql-test/main/show_explain_json.result +++ b/mysql-test/main/show_explain_json.result @@ -159,8 +159,8 @@ SHOW EXPLAIN Warnings: Note 1003 explain select max(c) from t1 where a < 10 connection con1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 Using index condition; Rowid-ordered scan # Same for EXPLAIN FOR CONNECTION explain select max(c) from t1 where a < 10; connection default; @@ -190,8 +190,8 @@ SHOW EXPLAIN Warnings: Note 1003 explain select max(c) from t1 where a < 10 connection con1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 Using index condition; Rowid-ordered scan set optimizer_switch= @show_expl_tmp; SET debug_dbug=@old_debug; # UNION, first branch @@ -245,10 +245,10 @@ SHOW EXPLAIN Warnings: Note 1003 explain select a from t0 A union select a+1 from t0 B connection con1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 -2 UNION B ALL NULL NULL NULL NULL 10 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 +2 UNION B NULL ALL NULL NULL NULL NULL 10 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL SET debug_dbug=@old_debug; # UNION, second branch set @show_explain_probe_select_id=2; @@ -301,10 +301,10 @@ SHOW EXPLAIN Warnings: Note 1003 explain select a from t0 A union select a+1 from t0 B connection con1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 -2 UNION B ALL NULL NULL NULL NULL 10 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 +2 UNION B NULL ALL NULL NULL NULL NULL 10 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL SET debug_dbug=@old_debug; # Uncorrelated subquery, select set @show_explain_probe_select_id=1; @@ -312,9 +312,9 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 B) from t0 A where a<1; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where -2 SUBQUERY B ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 Warnings: Note 1003 select a, (select max(a) from t0 B) from t0 A where a<1 connection con1; @@ -327,15 +327,15 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; explain select a, (select max(a) from t0 B) from t0 A where a<1; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where -2 SUBQUERY B ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 Warnings: Note 1003 explain select a, (select max(a) from t0 B) from t0 A where a<1 connection con1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where -2 SUBQUERY B ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 SET debug_dbug=@old_debug; # correlated subquery, select set @show_explain_probe_select_id=1; @@ -343,9 +343,9 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1 connection con1; @@ -358,15 +358,15 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start'; explain select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 explain select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1 connection con1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 Using where SET debug_dbug=@old_debug; # correlated subquery, select, while inside the subquery set @show_explain_probe_select_id=2; @@ -1109,8 +1109,8 @@ SET debug_dbug=@old_debug; # SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort" # explain select * from t0 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using filesort SET debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; select * from t0 order by a; @@ -1157,8 +1157,8 @@ SET debug_dbug=@old_debug; # connection default; explain select distinct a from t0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using temporary connection con1; SET debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; @@ -1203,8 +1203,8 @@ SET debug_dbug=@old_debug; # connection default; explain select distinct a from t0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using temporary connection con1; SET debug_dbug='+d,show_explain_probe_join_exec_start'; set @show_explain_probe_select_id=1; diff --git a/mysql-test/main/show_explain_non_select.result b/mysql-test/main/show_explain_non_select.result index 8d96056ca91..a6cf190e5a9 100644 --- a/mysql-test/main/show_explain_non_select.result +++ b/mysql-test/main/show_explain_non_select.result @@ -18,8 +18,8 @@ SET debug_dbug='+d,show_explain_probe_delete_exec_start'; delete from t1 where a<10 and b+1>1000; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 1 Using where Warnings: Note 1003 delete from t1 where a<10 and b+1>1000 connection con2; @@ -31,9 +31,9 @@ SET debug_dbug='+d,show_explain_probe_do_select'; delete t1 from t1, t0 where t0.a=t1.a and t1.b +1 > 1000; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 8 Using where -1 SIMPLE t1 ref a a 5 test.t0.a 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 Using where +1 SIMPLE t1 NULL ref a a 5 test.t0.a 4 Using where Warnings: Note 1003 delete t1 from t1, t0 where t0.a=t1.a and t1.b +1 > 1000 connection con2; @@ -45,8 +45,8 @@ SET debug_dbug='+d,show_explain_probe_update_exec_start'; update t1 set filler='filler-data-2' where a<10 and b+1>1000; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 1 Using where Warnings: Note 1003 update t1 set filler='filler-data-2' where a<10 and b+1>1000 connection con2; diff --git a/mysql-test/main/show_explain_ps.result b/mysql-test/main/show_explain_ps.result index 1c3be0d5953..2319908b27b 100644 --- a/mysql-test/main/show_explain_ps.result +++ b/mysql-test/main/show_explain_ps.result @@ -22,8 +22,8 @@ SET debug_dbug='d,show_explain_probe_join_exec_start'; select count(*) from t0 where a < 100000; connection default; show explain for $thr2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using where Warnings: Note 1003 select count(*) from t0 where a < 100000 connection con1; diff --git a/mysql-test/main/single_delete_update.result b/mysql-test/main/single_delete_update.result index 85e79f53c89..bdf058b8fea 100644 --- a/mysql-test/main/single_delete_update.result +++ b/mysql-test/main/single_delete_update.result @@ -358,8 +358,8 @@ Handler_read_rnd 4 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; -id select_type table type possible_keys key key_len ref rows filtered Extra -x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort Warnings: x x x FLUSH STATUS; @@ -385,8 +385,8 @@ Handler_read_rnd_next 0 SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; i key1 key2 EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; -id select_type table type possible_keys key key_len ref rows filtered Extra -x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort Warnings: x x x DROP TABLE t2; @@ -965,8 +965,8 @@ Handler_read_rnd 4 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; -id select_type table type possible_keys key key_len ref rows filtered Extra -x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort Warnings: x x x FLUSH STATUS; @@ -996,8 +996,8 @@ i key1 key2 123 12 12 123 13 13 EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; -id select_type table type possible_keys key key_len ref rows filtered Extra -x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x x x x x x x x x x x Using sort_union(key1,key2); Using where; Using filesort Warnings: x x x DROP TABLE t2; diff --git a/mysql-test/main/single_delete_update.test b/mysql-test/main/single_delete_update.test index ec939641ea3..5a990e50bb2 100644 --- a/mysql-test/main/single_delete_update.test +++ b/mysql-test/main/single_delete_update.test @@ -148,7 +148,7 @@ FLUSH STATUS; SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; SHOW SESSION STATUS LIKE 'Sort%'; SHOW STATUS LIKE 'Handler_read_%'; ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; FLUSH STATUS; @@ -156,7 +156,7 @@ DELETE FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; SHOW SESSION STATUS LIKE 'Sort%'; SHOW STATUS LIKE 'Handler_read_%'; SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; DROP TABLE t2; @@ -373,7 +373,7 @@ FLUSH STATUS; SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; SHOW SESSION STATUS LIKE 'Sort%'; SHOW STATUS LIKE 'Handler_read_%'; ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; FLUSH STATUS; @@ -381,7 +381,7 @@ UPDATE t2 SET i = 123 WHERE key1 < 13 or key2 < 14 ORDER BY key1; SHOW SESSION STATUS LIKE 'Sort%'; SHOW STATUS LIKE 'Handler_read_%'; SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; ---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; DROP TABLE t2; diff --git a/mysql-test/main/sp-anchor-row-type-cursor.result b/mysql-test/main/sp-anchor-row-type-cursor.result index 64359988a3d..5a87fb81eb7 100644 --- a/mysql-test/main/sp-anchor-row-type-cursor.result +++ b/mysql-test/main/sp-anchor-row-type-cursor.result @@ -688,8 +688,8 @@ END; END; $$ CALL p1(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select rec.a@0["a"] AS `rec.a`,rec.b@0["b"] AS `rec.b` DROP PROCEDURE p1; diff --git a/mysql-test/main/sp-anchor-row-type-table.result b/mysql-test/main/sp-anchor-row-type-table.result index b51ee5bf55d..f01fb3eb2bc 100644 --- a/mysql-test/main/sp-anchor-row-type-table.result +++ b/mysql-test/main/sp-anchor-row-type-table.result @@ -518,8 +518,8 @@ EXPLAIN EXTENDED SELECT rec.a, rec.b; END; $$ CALL p1(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select rec.a@0["a"] AS `rec.a`,rec.b@0["b"] AS `rec.b` DROP PROCEDURE p1; diff --git a/mysql-test/main/sp-row.result b/mysql-test/main/sp-row.result index 2764b4cd999..1d590797b16 100644 --- a/mysql-test/main/sp-row.result +++ b/mysql-test/main/sp-row.result @@ -2261,8 +2261,8 @@ DECLARE a ROW(a INT); EXPLAIN SELECT 1 INTO a.a; END; $$ -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used # # MDEV-14139 Anchored data types for variables # diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result index a7faeaf2f0d..76e19195ed2 100644 --- a/mysql-test/main/sp.result +++ b/mysql-test/main/sp.result @@ -6367,26 +6367,26 @@ CREATE TABLE t1 (c1 INT, INDEX(c1)); INSERT INTO t1 VALUES (1), (2), (3), (4), (5); CREATE VIEW v1 AS SELECT c1 FROM t1; EXPLAIN SELECT * FROM t1 WHERE c1=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c1 c1 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref c1 c1 5 const 1 Using index EXPLAIN SELECT * FROM t1 WHERE c1=f1(); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref c1 c1 5 const 1 Using where; Using index EXPLAIN SELECT * FROM v1 WHERE c1=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c1 c1 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref c1 c1 5 const 1 Using index EXPLAIN SELECT * FROM v1 WHERE c1=f1(); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref c1 c1 5 const 1 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE c1=f2(10); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref c1 c1 5 const 1 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE c1=f2(c1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL c1 5 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL c1 5 NULL 5 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE c1=f2(rand()); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL c1 5 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL c1 5 NULL 5 Using where; Using index DROP VIEW v1; DROP FUNCTION f1; DROP FUNCTION f2; diff --git a/mysql-test/main/ssl.result b/mysql-test/main/ssl.result index 794830e5529..43ce06892ab 100644 --- a/mysql-test/main/ssl.result +++ b/mysql-test/main/ssl.result @@ -137,20 +137,20 @@ fld3 select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%'; fld3 explain select t2.fld3 from t2 where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3,not_used); ERROR 42000: Key 'not_used' doesn't exist in table 't2' explain select fld3 from t2 use index (not_used); @@ -160,8 +160,8 @@ fld3 honeysuckle honoring explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld3 fld3 30 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 Using where; Using index select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3; fld1 fld3 148504 Colombo @@ -180,8 +180,8 @@ fld1 250501 250502 explain select fld1 from t2 where fld1=250501 or fld1="250502"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld1 fld1 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 Using where; Using index select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502; fld1 250501 @@ -189,8 +189,8 @@ fld1 250505 250601 explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 Using where; Using index select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; fld1 fld3 012001 flanking @@ -606,21 +606,21 @@ companynr rtrim(space(512+companynr)) select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3; fld3 explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort -1 SIMPLE t3 ref period period 4 test.t1.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index period period 4 NULL 1 -1 SIMPLE t1 ref period period 4 test.t3.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL index period period 4 NULL 1 +1 SIMPLE t1 NULL ref period period 4 test.t3.period 4181 explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index period period 4 NULL 1 -1 SIMPLE t3 ref period period 4 test.t1.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index period period 4 NULL 1 +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 select period from t1; period 9410 @@ -633,9 +633,9 @@ select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3. fld3 period breaking 1001 explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const fld1 fld1 4 const 1 -1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const fld1 fld1 4 const 1 +1 SIMPLE t3 NULL const PRIMARY,period PRIMARY 4 const 1 select fld3,period from t2,t1 where companynr*10 = 37*10; fld3 period breaking 9410 @@ -1369,82 +1369,82 @@ select count(*) from t2 left join t4 using (companynr) where t4.companynr is not count(*) 1199 explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 Using where; Not exists select companynr,companyname from t2 left join t4 using (companynr) where companynr is null; companynr companyname select count(*) from t2 left join t4 using (companynr) where companynr is not null; count(*) 1200 explain select companynr,companyname from t2 left join t4 using (companynr) where companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE delete from t2 where fld1=999999; explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where SET @@optimizer_switch=@local_optimizer_switch; select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; companynr companynr 37 36 41 40 explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL index NULL PRIMARY 1 NULL 12 Using index; Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join) SET @@join_cache_level=@local_join_cache_level; select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008; fld1 companynr fld3 period @@ -1518,8 +1518,8 @@ select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069 explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>""; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; @@ -1959,11 +1959,11 @@ select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = fld1 sum(price) 038008 234298 explain select fld3 from t2 where 1>2 or 2>3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select fld3 from t2 where fld1=fld1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502; companynr fld1 34 250501 @@ -2014,8 +2014,8 @@ select count(*) from t3 where companynr=512 and price2=76234234; count(*) 4181 explain select min(fld1),max(fld1),count(*) from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(fld1),max(fld1),count(*) from t2; min(fld1) max(fld1) count(*) 0 1232609 1199 diff --git a/mysql-test/main/ssl_compress.result b/mysql-test/main/ssl_compress.result index 69de425cdc1..6ec561c741b 100644 --- a/mysql-test/main/ssl_compress.result +++ b/mysql-test/main/ssl_compress.result @@ -134,20 +134,20 @@ fld3 select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%'; fld3 explain select t2.fld3 from t2 where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index explain select fld3 from t2 ignore index (fld3,not_used); ERROR 42000: Key 'not_used' doesn't exist in table 't2' explain select fld3 from t2 use index (not_used); @@ -157,8 +157,8 @@ fld3 honeysuckle honoring explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld3 fld3 30 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 Using where; Using index select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3; fld1 fld3 148504 Colombo @@ -177,8 +177,8 @@ fld1 250501 250502 explain select fld1 from t2 where fld1=250501 or fld1="250502"; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld1 fld1 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 Using where; Using index select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502; fld1 250501 @@ -186,8 +186,8 @@ fld1 250505 250601 explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 Using where; Using index select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; fld1 fld3 012001 flanking @@ -603,21 +603,21 @@ companynr rtrim(space(512+companynr)) select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3; fld3 explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 Using where; Using index explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort -1 SIMPLE t3 ref period period 4 test.t1.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index period period 4 NULL 1 -1 SIMPLE t1 ref period period 4 test.t3.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL index period period 4 NULL 1 +1 SIMPLE t1 NULL ref period period 4 test.t3.period 4181 explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index period period 4 NULL 1 -1 SIMPLE t3 ref period period 4 test.t1.period 4181 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index period period 4 NULL 1 +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 select period from t1; period 9410 @@ -630,9 +630,9 @@ select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3. fld3 period breaking 1001 explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const fld1 fld1 4 const 1 -1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const fld1 fld1 4 const 1 +1 SIMPLE t3 NULL const PRIMARY,period PRIMARY 4 const 1 select fld3,period from t2,t1 where companynr*10 = 37*10; fld3 period breaking 9410 @@ -1366,82 +1366,82 @@ select count(*) from t2 left join t4 using (companynr) where t4.companynr is not count(*) 1199 explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 Using where; Not exists +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 Using where; Not exists select companynr,companyname from t2 left join t4 using (companynr) where companynr is null; companynr companyname select count(*) from t2 left join t4 using (companynr) where companynr is not null; count(*) 1200 explain select companynr,companyname from t2 left join t4 using (companynr) where companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE delete from t2 where fld1=999999; explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where SET @@optimizer_switch=@local_optimizer_switch; select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; companynr companynr 37 36 41 40 explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using index; Using temporary -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL index NULL PRIMARY 1 NULL 12 Using index; Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 Using where; Using join buffer (flat, BNL join) SET @@join_cache_level=@local_join_cache_level; select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008; fld1 companynr fld3 period @@ -1515,8 +1515,8 @@ select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069 explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>""; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where `test`.`t2`.`companynr` = 34 and `test`.`t2`.`fld4` <> '' select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; @@ -1956,11 +1956,11 @@ select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = fld1 sum(price) 038008 234298 explain select fld3 from t2 where 1>2 or 2>3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE explain select fld3 from t2 where fld1=fld1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502; companynr fld1 34 250501 @@ -2011,8 +2011,8 @@ select count(*) from t3 where companynr=512 and price2=76234234; count(*) 4181 explain select min(fld1),max(fld1),count(*) from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away select min(fld1),max(fld1),count(*) from t2; min(fld1) max(fld1) count(*) 0 1232609 1199 diff --git a/mysql-test/main/stat_tables.result b/mysql-test/main/stat_tables.result index 22f5bfafb8e..68d1f2971ac 100644 --- a/mysql-test/main/stat_tables.result +++ b/mysql-test/main/stat_tables.result @@ -68,13 +68,13 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' and o_orderdate < date '1995-01-01' + interval '1' year group by n_name order by revenue desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort -1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 -1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 -1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 -1 SIMPLE orders ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (12%) Using where; Using rowid filter -1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE region NULL ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort +1 SIMPLE nation NULL ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 +1 SIMPLE supplier NULL ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 +1 SIMPLE customer NULL ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 +1 SIMPLE orders NULL ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (12%) Using where; Using rowid filter +1 SIMPLE lineitem NULL ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region where c_custkey = o_custkey and l_orderkey = o_orderkey @@ -175,13 +175,13 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' and o_orderdate < date '1995-01-01' + interval '1' year group by n_name order by revenue desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort -1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 -1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 -1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 -1 SIMPLE orders ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (12%) Using where; Using rowid filter -1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE region NULL ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort +1 SIMPLE nation NULL ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 +1 SIMPLE supplier NULL ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 +1 SIMPLE customer NULL ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 +1 SIMPLE orders NULL ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (12%) Using where; Using rowid filter +1 SIMPLE lineitem NULL ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region where c_custkey = o_custkey and l_orderkey = o_orderkey @@ -211,15 +211,15 @@ and o_orderdate between date '1995-01-01' and date '1996-12-31' and p_type = 'STANDARD BRUSHED STEEL' ) as all_nations group by o_year order by o_year; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort -1 SIMPLE part ALL PRIMARY NULL NULL NULL 200 Using where; Using join buffer (flat, BNL join) -1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_partkey 5 dbt3_s001.part.p_partkey 30 Using where -1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where -1 SIMPLE orders eq_ref|filter PRIMARY,i_o_orderdate,i_o_custkey PRIMARY|i_o_orderdate 4|4 dbt3_s001.lineitem.l_orderkey 1 (27%) Using where; Using rowid filter -1 SIMPLE n2 eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 -1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where -1 SIMPLE n1 eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE region NULL ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort +1 SIMPLE part NULL ALL PRIMARY NULL NULL NULL 200 Using where; Using join buffer (flat, BNL join) +1 SIMPLE lineitem NULL ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_partkey 5 dbt3_s001.part.p_partkey 30 Using where +1 SIMPLE supplier NULL eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where +1 SIMPLE orders NULL eq_ref|filter PRIMARY,i_o_orderdate,i_o_custkey PRIMARY|i_o_orderdate 4|4 dbt3_s001.lineitem.l_orderkey 1 (27%) Using where; Using rowid filter +1 SIMPLE n2 NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 +1 SIMPLE customer NULL eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where +1 SIMPLE n1 NULL eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 Using where select o_year, sum(case when nation = 'UNITED STATES' then volume else 0 end) / sum(volume) as mkt_share @@ -250,13 +250,13 @@ and o_orderkey = l_orderkey and s_nationkey = n_nationkey and p_name like '%green%') as profit group by nation, o_year order by nation, o_year desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE supplier ALL PRIMARY,i_s_nationkey NULL NULL NULL 10 Using where; Using temporary; Using filesort -1 SIMPLE nation eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 -1 SIMPLE partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_suppkey 4 dbt3_s001.supplier.s_suppkey 70 -1 SIMPLE part eq_ref PRIMARY PRIMARY 4 dbt3_s001.partsupp.ps_partkey 1 Using where -1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.supplier.s_suppkey 8 -1 SIMPLE orders eq_ref PRIMARY PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE supplier NULL ALL PRIMARY,i_s_nationkey NULL NULL NULL 10 Using where; Using temporary; Using filesort +1 SIMPLE nation NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 +1 SIMPLE partsupp NULL ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_suppkey 4 dbt3_s001.supplier.s_suppkey 70 +1 SIMPLE part NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.partsupp.ps_partkey 1 Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.supplier.s_suppkey 8 +1 SIMPLE orders NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 select nation, o_year, sum(amount) as sum_profit from (select n_name as nation, extract(year from o_orderdate) as o_year, @@ -334,10 +334,10 @@ EXPLAIN select o_orderkey, p_partkey from part, lineitem, orders where p_retailprice > 1100 and o_orderdate='1997-01-01' and o_orderkey=l_orderkey and p_partkey=l_partkey; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE part range PRIMARY,i_p_retailprice i_p_retailprice 9 NULL 1 Using index condition -1 SIMPLE orders ref PRIMARY,i_o_orderdate i_o_orderdate 4 const 1 -1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE part NULL range PRIMARY,i_p_retailprice i_p_retailprice 9 NULL 1 Using index condition +1 SIMPLE orders NULL ref PRIMARY,i_o_orderdate i_o_orderdate 4 const 1 +1 SIMPLE lineitem NULL ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey 4 dbt3_s001.orders.o_orderkey 4 Using where select o_orderkey, p_partkey from part, lineitem, orders where p_retailprice > 1100 and o_orderdate='1997-01-01' @@ -379,13 +379,13 @@ INSERT INTO t1 VALUES (1),(2); FLUSH TABLE t1; SET use_stat_tables='never'; EXPLAIN SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 FLUSH TABLES; SET use_stat_tables='preferably'; EXPLAIN SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 DROP TABLE t1; set use_stat_tables=@save_use_stat_tables; # @@ -410,9 +410,9 @@ id name 1 AUS EXPLAIN SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 0 Using where ANALYZE TABLE t2; Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected @@ -422,9 +422,9 @@ id name 1 AUS EXPLAIN SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where DROP TABLE t1,t2; # # MDEV-7370: Server deadlocks on renaming a table for which persistent statistics exists @@ -590,9 +590,9 @@ set @@optimizer_use_condition_selectivity=4; set @@use_stat_tables= PREFERABLY; explain SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL -1 SIMPLE global_priv ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE PROFILING NULL ALL NULL NULL NULL NULL NULL +1 SIMPLE global_priv NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; # @@ -769,8 +769,8 @@ select HEX(RIGHT(max_value, 1)), length(max_value) from mysql.column_stats where HEX(RIGHT(max_value, 1)) length(max_value) A5 254 analyze select * from t1 where a >= 'ӥ'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where set @save_sql_mode= @@sql_mode; set sql_mode='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; update mysql.column_stats set min_value= REPEAT('ӥ',255) where db_name='test' and table_name='t1'; @@ -780,8 +780,8 @@ select HEX(RIGHT(min_value, 1)), length(min_value) from mysql.column_stats where HEX(RIGHT(min_value, 1)) length(min_value) D3 255 analyze select * from t1 where a >= 'ӥ'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where set names latin1; drop table t1; CREATE TABLE t1 (col1 date); @@ -864,8 +864,8 @@ select * from mysql.column_stats; db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram analyze select * from t1 where a = 1 and b=3; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where # # with use_stat_tables= PREFERABLY_FOR_QUERIES # analyze table t1 will collect statistics if we use PERSISTENT @@ -881,8 +881,8 @@ test t1 a 1 4 0.0000 4.0000 2.5000 0 NULL NULL # filtered shows that we used the data from stat tables analyze select * from t1 where a = 1 and b=3; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 25.00 10.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 25.00 10.00 Using where # # with use_stat_tables= PREFERABLY # analyze table t1 will collect statistics @@ -899,8 +899,8 @@ test t1 b 2 10 0.0000 4.0000 1.1111 0 NULL NULL # filtered shows that we used the data from stat tables analyze select * from t1 where a=1 and b=3; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 2.78 10.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 2.78 10.00 Using where drop table t1; set @@global.histogram_size=@save_histogram_size; # End of 10.4 tests diff --git a/mysql-test/main/stat_tables_disabled.result b/mysql-test/main/stat_tables_disabled.result index 14be9535ea4..3a5db32bd60 100644 --- a/mysql-test/main/stat_tables_disabled.result +++ b/mysql-test/main/stat_tables_disabled.result @@ -34,10 +34,10 @@ and l_orderkey = o_orderkey and o_orderdate < date '1995-03-15' group by l_orderkey, o_orderdate, o_shippriority order by revenue desc, o_orderdate limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL # Using where; Using temporary; Using filesort -1 SIMPLE customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey # Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey # Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL # Using where; Using temporary; Using filesort +1 SIMPLE customer NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey # Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey # Using where set use_stat_tables='preferably'; EXPLAIN select sql_calc_found_rows straight_join l_orderkey, sum(l_extendedprice*(1-l_discount)) as revenue, @@ -49,10 +49,10 @@ and l_orderkey = o_orderkey and o_orderdate < date '1995-03-15' group by l_orderkey, o_orderdate, o_shippriority order by revenue desc, o_orderdate limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL 1500 Using where; Using temporary; Using filesort -1 SIMPLE customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL 1500 Using where; Using temporary; Using filesort +1 SIMPLE customer NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where flush tables customer, orders, lineitem; EXPLAIN select sql_calc_found_rows straight_join l_orderkey, sum(l_extendedprice*(1-l_discount)) as revenue, @@ -64,10 +64,10 @@ and l_orderkey = o_orderkey and o_orderdate < date '1995-03-15' group by l_orderkey, o_orderdate, o_shippriority order by revenue desc, o_orderdate limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL 1500 Using where; Using temporary; Using filesort -1 SIMPLE customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where -1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE orders NULL ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL 1500 Using where; Using temporary; Using filesort +1 SIMPLE customer NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where # End of the test case for mdev-503 set optimizer_switch=@save_optimizer_switch; DROP DATABASE dbt3_s001; diff --git a/mysql-test/main/stat_tables_disabled.test b/mysql-test/main/stat_tables_disabled.test index e6b965afe34..f6b2d552134 100644 --- a/mysql-test/main/stat_tables_disabled.test +++ b/mysql-test/main/stat_tables_disabled.test @@ -60,7 +60,7 @@ order by revenue desc, o_orderdate limit 10; set use_stat_tables='never'; ---replace_column 9 # +--replace_column 10 # eval EXPLAIN $Q3S; set use_stat_tables='preferably'; diff --git a/mysql-test/main/stat_tables_innodb.result b/mysql-test/main/stat_tables_innodb.result index 5b62f228b1f..4edd8715444 100644 --- a/mysql-test/main/stat_tables_innodb.result +++ b/mysql-test/main/stat_tables_innodb.result @@ -76,13 +76,13 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' and o_orderdate < date '1995-01-01' + interval '1' year group by n_name order by revenue desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort -1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 -1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 Using index -1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index -1 SIMPLE orders ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (14%) Using where; Using rowid filter -1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey 9 dbt3_s001.supplier.s_suppkey,dbt3_s001.orders.o_orderkey 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE region NULL ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort +1 SIMPLE nation NULL ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 +1 SIMPLE supplier NULL ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 Using index +1 SIMPLE customer NULL ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index +1 SIMPLE orders NULL ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (14%) Using where; Using rowid filter +1 SIMPLE lineitem NULL ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey 9 dbt3_s001.supplier.s_suppkey,dbt3_s001.orders.o_orderkey 1 select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region where c_custkey = o_custkey and l_orderkey = o_orderkey @@ -207,13 +207,13 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' and o_orderdate < date '1995-01-01' + interval '1' year group by n_name order by revenue desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort -1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 -1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 Using index -1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index -1 SIMPLE orders ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (14%) Using where; Using rowid filter -1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey 9 dbt3_s001.supplier.s_suppkey,dbt3_s001.orders.o_orderkey 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE region NULL ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort +1 SIMPLE nation NULL ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 +1 SIMPLE supplier NULL ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 Using index +1 SIMPLE customer NULL ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index +1 SIMPLE orders NULL ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (14%) Using where; Using rowid filter +1 SIMPLE lineitem NULL ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey 9 dbt3_s001.supplier.s_suppkey,dbt3_s001.orders.o_orderkey 1 select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region where c_custkey = o_custkey and l_orderkey = o_orderkey @@ -243,15 +243,15 @@ and o_orderdate between date '1995-01-01' and date '1996-12-31' and p_type = 'STANDARD BRUSHED STEEL' ) as all_nations group by o_year order by o_year; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort -1 SIMPLE part ALL PRIMARY NULL NULL NULL 200 Using where; Using join buffer (flat, BNL join) -1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_partkey 5 dbt3_s001.part.p_partkey 30 Using where -1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where -1 SIMPLE n2 eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 -1 SIMPLE orders eq_ref PRIMARY,i_o_orderdate,i_o_custkey PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where -1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where -1 SIMPLE n1 eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE region NULL ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort +1 SIMPLE part NULL ALL PRIMARY NULL NULL NULL 200 Using where; Using join buffer (flat, BNL join) +1 SIMPLE lineitem NULL ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_partkey 5 dbt3_s001.part.p_partkey 30 Using where +1 SIMPLE supplier NULL eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where +1 SIMPLE n2 NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_orderdate,i_o_custkey PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where +1 SIMPLE customer NULL eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where +1 SIMPLE n1 NULL eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 Using where select o_year, sum(case when nation = 'UNITED STATES' then volume else 0 end) / sum(volume) as mkt_share @@ -282,13 +282,13 @@ and o_orderkey = l_orderkey and s_nationkey = n_nationkey and p_name like '%green%') as profit group by nation, o_year order by nation, o_year desc; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE supplier index PRIMARY,i_s_nationkey i_s_nationkey 5 NULL 10 Using where; Using index; Using temporary; Using filesort -1 SIMPLE nation eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 -1 SIMPLE partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_suppkey 4 dbt3_s001.supplier.s_suppkey 70 -1 SIMPLE part eq_ref PRIMARY PRIMARY 4 dbt3_s001.partsupp.ps_partkey 1 Using where -1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.supplier.s_suppkey 8 -1 SIMPLE orders eq_ref PRIMARY PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE supplier NULL index PRIMARY,i_s_nationkey i_s_nationkey 5 NULL 10 Using where; Using index; Using temporary; Using filesort +1 SIMPLE nation NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 +1 SIMPLE partsupp NULL ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_suppkey 4 dbt3_s001.supplier.s_suppkey 70 +1 SIMPLE part NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.partsupp.ps_partkey 1 Using where +1 SIMPLE lineitem NULL ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.supplier.s_suppkey 8 +1 SIMPLE orders NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 select nation, o_year, sum(amount) as sum_profit from (select n_name as nation, extract(year from o_orderdate) as o_year, @@ -366,10 +366,10 @@ EXPLAIN select o_orderkey, p_partkey from part, lineitem, orders where p_retailprice > 1100 and o_orderdate='1997-01-01' and o_orderkey=l_orderkey and p_partkey=l_partkey; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE part range PRIMARY,i_p_retailprice i_p_retailprice 9 NULL 1 Using where; Using index -1 SIMPLE orders ref PRIMARY,i_o_orderdate i_o_orderdate 4 const 1 Using index -1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_orderkey,i_l_orderkey_quantity i_l_partkey 9 dbt3_s001.part.p_partkey,dbt3_s001.orders.o_orderkey 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE part NULL range PRIMARY,i_p_retailprice i_p_retailprice 9 NULL 1 Using where; Using index +1 SIMPLE orders NULL ref PRIMARY,i_o_orderdate i_o_orderdate 4 const 1 Using index +1 SIMPLE lineitem NULL ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_orderkey,i_l_orderkey_quantity i_l_partkey 9 dbt3_s001.part.p_partkey,dbt3_s001.orders.o_orderkey 1 Using index select o_orderkey, p_partkey from part, lineitem, orders where p_retailprice > 1100 and o_orderdate='1997-01-01' @@ -411,13 +411,13 @@ INSERT INTO t1 VALUES (1),(2); FLUSH TABLE t1; SET use_stat_tables='never'; EXPLAIN SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 FLUSH TABLES; SET use_stat_tables='preferably'; EXPLAIN SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 DROP TABLE t1; set use_stat_tables=@save_use_stat_tables; # @@ -442,9 +442,9 @@ id name 1 AUS EXPLAIN SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 0 Using where ANALYZE TABLE t2; Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected @@ -454,9 +454,9 @@ id name 1 AUS EXPLAIN SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where DROP TABLE t1,t2; # # MDEV-7370: Server deadlocks on renaming a table for which persistent statistics exists @@ -622,9 +622,9 @@ set @@optimizer_use_condition_selectivity=4; set @@use_stat_tables= PREFERABLY; explain SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL -1 SIMPLE global_priv ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE PROFILING NULL ALL NULL NULL NULL NULL NULL +1 SIMPLE global_priv NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; # @@ -801,8 +801,8 @@ select HEX(RIGHT(max_value, 1)), length(max_value) from mysql.column_stats where HEX(RIGHT(max_value, 1)) length(max_value) A5 254 analyze select * from t1 where a >= 'ӥ'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where set @save_sql_mode= @@sql_mode; set sql_mode='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; update mysql.column_stats set min_value= REPEAT('ӥ',255) where db_name='test' and table_name='t1'; @@ -812,8 +812,8 @@ select HEX(RIGHT(min_value, 1)), length(min_value) from mysql.column_stats where HEX(RIGHT(min_value, 1)) length(min_value) D3 255 analyze select * from t1 where a >= 'ӥ'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where set names latin1; drop table t1; CREATE TABLE t1 (col1 date); @@ -896,8 +896,8 @@ select * from mysql.column_stats; db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram analyze select * from t1 where a = 1 and b=3; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where # # with use_stat_tables= PREFERABLY_FOR_QUERIES # analyze table t1 will collect statistics if we use PERSISTENT @@ -913,8 +913,8 @@ test t1 a 1 4 0.0000 4.0000 2.5000 0 NULL NULL # filtered shows that we used the data from stat tables analyze select * from t1 where a = 1 and b=3; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 25.00 10.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 25.00 10.00 Using where # # with use_stat_tables= PREFERABLY # analyze table t1 will collect statistics @@ -931,8 +931,8 @@ test t1 b 2 10 0.0000 4.0000 1.1111 0 NULL NULL # filtered shows that we used the data from stat tables analyze select * from t1 where a=1 and b=3; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 2.78 10.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 10.00 2.78 10.00 Using where drop table t1; set @@global.histogram_size=@save_histogram_size; # End of 10.4 tests diff --git a/mysql-test/main/statistics.result b/mysql-test/main/statistics.result index 43b28f464e1..82a33fbaf6d 100644 --- a/mysql-test/main/statistics.result +++ b/mysql-test/main/statistics.result @@ -1868,8 +1868,8 @@ select count(*) from t1; count(*) 229376 explain select * from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 229060 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 229060 set analyze_sample_percentage=100; ANALYZE TABLE t1; Table Op Msg_type Msg_text @@ -1881,8 +1881,8 @@ from mysql.column_stats; table_name column_name min_value max_value nulls_ratio avg_length avg_frequency DECODE_HISTOGRAM(hist_type, histogram) t1 id 1 17384 0.0000 4.0000 14.0000 0.15705,0.15711,0.21463,0.15705,0.15711,0.15706 explain select * from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 229376 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 229376 drop table t0; drop table t1; set analyze_sample_percentage=@save_analyze_sample_percentage; diff --git a/mysql-test/main/statistics_json.result b/mysql-test/main/statistics_json.result index a9740056777..e76eb05d989 100644 --- a/mysql-test/main/statistics_json.result +++ b/mysql-test/main/statistics_json.result @@ -4459,8 +4459,8 @@ select count(*) from t1; count(*) 229376 explain select * from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 229060 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 229060 set analyze_sample_percentage=100; ANALYZE TABLE t1; Table Op Msg_type Msg_text @@ -4529,8 +4529,8 @@ t1 id 1 17384 0.0000 4.0000 14.0000 { ] } explain select * from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 229376 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 229376 drop table t0; drop table t1; set analyze_sample_percentage=@save_analyze_sample_percentage; @@ -4555,13 +4555,13 @@ select hex(histogram) from mysql.column_stats where table_name='t1_bin'; hex(histogram) 00000000000000000000711C711C711C711C711CE338E338E338E338E33855555555555555555555C671C671C671C671C671388E388E388E388E388EAAAAAAAAAAAAAAAAAAAA1BC71BC71BC71BC71BC78DE38DE38DE38DE38DE3FFFFFFFFFFFFFFFFFFFF explain extended select * from t1_bin where a between 'a-3a' and 'zzzzzzzzz'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1_bin ALL NULL NULL NULL NULL 10 58.82 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1_bin NULL ALL NULL NULL NULL NULL 10 58.82 Using where Warnings: Note 1003 select `test`.`t1_bin`.`a` AS `a` from `test`.`t1_bin` where `test`.`t1_bin`.`a` between 'a-3a' and 'zzzzzzzzz' analyze select * from t1_bin where a between 'a-3a' and 'zzzzzzzzz'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1_bin ALL NULL NULL NULL NULL 10 10.00 58.82 60.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1_bin NULL ALL NULL NULL NULL NULL 10 10.00 58.82 60.00 Using where set histogram_type=json_hb; create table t1_json (a varchar(255)); insert into t1_json select concat('a-', a) from ten; @@ -4630,36 +4630,36 @@ test t1_json a a-0 a-9 0.0000 3.0000 1.0000 10 JSON_HB { ] } explain extended select * from t1_json where a between 'a-3a' and 'zzzzzzzzz'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 60.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 60.00 Using where Warnings: Note 1003 select `test`.`t1_json`.`a` AS `a` from `test`.`t1_json` where `test`.`t1_json`.`a` between 'a-3a' and 'zzzzzzzzz' analyze select * from t1_json where a between 'a-3a' and 'zzzzzzzzz'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 10.00 60.00 60.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 10.00 60.00 60.00 Using where explain extended select * from t1_json where a < 'b-1a'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 100.00 Using where Warnings: Note 1003 select `test`.`t1_json`.`a` AS `a` from `test`.`t1_json` where `test`.`t1_json`.`a` < 'b-1a' analyze select * from t1_json where a > 'zzzzzzzzz'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 10.00 0.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 10.00 0.00 0.00 Using where drop table ten; UPDATE mysql.column_stats SET histogram='["not-what-you-expect"]' WHERE table_name='t1_json'; FLUSH TABLES; explain select * from t1_json limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 Warnings: Warning 4186 Failed to parse histogram for table test.t1_json: Root JSON element must be a JSON object at offset 1. UPDATE mysql.column_stats SET histogram='{"histogram_hb":"not-histogram"}' WHERE table_name='t1_json'; FLUSH TABLES; explain select * from t1_json limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 Warnings: Warning 4186 Failed to parse histogram for table test.t1_json: histogram_hb must contain an array at offset 32. UPDATE mysql.column_stats @@ -4667,8 +4667,8 @@ SET histogram='{"histogram_hb":["not-a-bucket"]}' WHERE table_name='t1_json'; FLUSH TABLES; explain select * from t1_json limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 Warnings: Warning 4186 Failed to parse histogram for table test.t1_json: Expected an object in the buckets array at offset 32. UPDATE mysql.column_stats @@ -4676,8 +4676,8 @@ SET histogram='{"histogram_hb":[{"no-expected-members":1}]}' WHERE table_name='t1_json'; FLUSH TABLES; explain select * from t1_json limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 Warnings: Warning 4186 Failed to parse histogram for table test.t1_json: "start" element not present at offset 42. UPDATE mysql.column_stats @@ -4685,8 +4685,8 @@ SET histogram='{"histogram_hb":[{"start":{}}]}' WHERE table_name='t1_json'; FLUSH TABLES; explain select * from t1_json limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 Warnings: Warning 4186 Failed to parse histogram for table test.t1_json: String or number expected at offset 27. UPDATE mysql.column_stats @@ -4694,8 +4694,8 @@ SET histogram='{"histogram_hb":[{"start":"aaa", "size":"not-an-integer"}]}' WHERE table_name='t1_json'; FLUSH TABLES; explain select * from t1_json limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 Warnings: Warning 4186 Failed to parse histogram for table test.t1_json: "ndv" element not present at offset 57. UPDATE mysql.column_stats @@ -4703,8 +4703,8 @@ SET histogram='{"histogram_hb":[{"start":"aaa", "size":0.25}]}' WHERE table_name='t1_json'; FLUSH TABLES; explain select * from t1_json limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 Warnings: Warning 4186 Failed to parse histogram for table test.t1_json: "ndv" element not present at offset 45. UPDATE mysql.column_stats @@ -4712,15 +4712,15 @@ SET histogram='{"histogram_hb":[{"start":"aaa", "size":0.25, "ndv":1}]}' WHERE table_name='t1_json'; FLUSH TABLES; explain select * from t1_json limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 UPDATE mysql.column_stats SET histogram='{"histogram_hb":[]}' WHERE table_name='t1_json'; FLUSH TABLES; explain select * from t1_json limit 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 Warnings: Warning 4186 Failed to parse histogram for table test.t1_json: Histogram must have at least one bucket at offset 19. create table t2 ( @@ -4735,24 +4735,24 @@ Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain extended select * from t2 where city = 'Moscow'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 101 98.02 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 101 98.02 Using where Warnings: Note 1003 select `test`.`t2`.`city` AS `city` from `test`.`t2` where `test`.`t2`.`city` = 'Moscow' analyze select * from t2 where city = 'Moscow'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 101 101.00 98.02 98.02 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 101 101.00 98.02 98.02 Using where explain extended select * from t2 where city = 'Helsinki'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 101 1.98 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 101 1.98 Using where Warnings: Note 1003 select `test`.`t2`.`city` AS `city` from `test`.`t2` where `test`.`t2`.`city` = 'Helsinki' analyze select * from t2 where city = 'helsinki'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 101 101.00 1.98 1.98 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 101 101.00 1.98 1.98 Using where explain extended select * from t2 where city < 'Lagos'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 101 1.98 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 101 1.98 Using where Warnings: Note 1003 select `test`.`t2`.`city` AS `city` from `test`.`t2` where `test`.`t2`.`city` < 'Lagos' drop table t1_bin; @@ -7728,11 +7728,11 @@ Percentage 0.0 99.9 47 JSON_HB { ] } analyze select * from Country use index () where Code between 'BBC' and 'GGG'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 239.00 24.58 25.52 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 239.00 24.58 25.52 Using where analyze select * from Country use index () where Code < 'BBC'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 239.00 8.37 7.11 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 239.00 8.37 7.11 Using where set histogram_type=@save_histogram_type; set histogram_size=@save_histogram_size; DROP SCHEMA world; @@ -7929,8 +7929,8 @@ JSON_HB { ] } analyze select * from t1 where a=_cp1251 x'88'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 5.00 60.00 60.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 5.00 60.00 60.00 Using where drop table t1; # # ASAN use-after-poison my_strnxfrm_simple_internal / Histogram_json_hb::range_selectivity ... @@ -8013,8 +8013,8 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK analyze select c from t1 where c > '1'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 16.00 75.00 75.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 16.00 75.00 75.00 Using where drop table t1; # # MDEV-26849: JSON Histograms: point selectivity estimates are off for non-existent values @@ -8101,23 +8101,23 @@ test t1 a 0 900 0.0000 4.0000 100.0000 10 JSON_HB { ] } analyze select * from t1 where a=0; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 10.00 10.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 1000.00 10.00 10.00 Using where analyze select * from t1 where a=50; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 0.10 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 1000.00 0.10 0.00 Using where analyze select * from t1 where a=70; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 0.10 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 1000.00 0.10 0.00 Using where analyze select * from t1 where a=100; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 10.00 10.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 1000.00 10.00 10.00 Using where analyze select * from t1 where a=150; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 0.10 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 1000.00 0.10 0.00 Using where analyze select * from t1 where a=200; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 10.00 10.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 1000.00 10.00 10.00 Using where drop table t0,t1; # # MDEV-26892: JSON histograms become invalid with a specific (corrupt) value in t @@ -8160,17 +8160,17 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK analyze select * from t1 where a <= 0; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 100 100.00 33.00 33.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 100 100.00 33.00 33.00 Using where analyze select * from t1 where a < 0; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 100 100.00 1.00 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 100 100.00 1.00 0.00 Using where analyze select * from t1 where a > 0; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 100 100.00 67.00 67.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 100 100.00 67.00 67.00 Using where analyze select * from t1 where a >= 0; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 100 100.00 100.00 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 100 100.00 100.00 100.00 Using where drop table t1; # # More test coverage @@ -8188,11 +8188,11 @@ Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK analyze select * from t2 where a < 1; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1011 1011.00 0.10 0.10 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1011 1011.00 0.10 0.10 Using where analyze select * from t2 where a =100; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 1011 1011.00 0.10 0.10 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1011 1011.00 0.10 0.10 Using where drop table t0,t1,t2; # # MDEV-27230: Estimation for filtered rows less precise ... @@ -8205,11 +8205,11 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK analyze select COUNT(*) FROM t1 WHERE a <> 'a'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 100 100.00 99.00 99.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 100 100.00 99.00 99.00 Using where analyze select COUNT(*) FROM t1 WHERE a < 'a'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 100 100.00 50.00 50.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 100 100.00 50.00 50.00 Using where drop table t1; # # MDEV-27229: Estimation for filtered rows less precise ... #5 @@ -8223,32 +8223,32 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK analyze select COUNT(*) FROM t1 WHERE a > 'foo'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 200 200.00 50.00 50.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 200 200.00 50.00 50.00 Using where analyze select COUNT(*) FROM t1 WHERE a > 'aaa'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 200 200.00 100.00 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 200 200.00 100.00 100.00 Using where analyze select COUNT(*) FROM t1 WHERE a >='aaa'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 200 200.00 100.00 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 200 200.00 100.00 100.00 Using where analyze select COUNT(*) FROM t1 WHERE a > 'bar'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 200 200.00 50.00 50.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 200 200.00 50.00 50.00 Using where analyze select COUNT(*) FROM t1 WHERE a >='bar'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 200 200.00 100.00 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 200 200.00 100.00 100.00 Using where analyze select COUNT(*) FROM t1 WHERE a < 'aaa'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 200 200.00 0.50 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 200 200.00 0.50 0.00 Using where analyze select COUNT(*) FROM t1 WHERE a <='aaa'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 200 200.00 0.50 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 200 200.00 0.50 0.00 Using where analyze select COUNT(*) FROM t1 WHERE a < 'bar'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 200 200.00 0.50 0.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 200 200.00 0.50 0.00 Using where analyze select COUNT(*) FROM t1 WHERE a <='bar'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 200 200.00 50.00 50.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 200 200.00 50.00 50.00 Using where drop table t1; # # MDEV-27243: Estimation for filtered rows less precise ... #7 @@ -8261,8 +8261,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK ANALYZE SELECT * FROM t1 WHERE f > '00:01:00'; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 50.00 50.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 1000.00 50.00 50.00 Using where drop table t1; # # MDEV-26901: Estimation for filtered rows less precise ... #4 @@ -8281,8 +8281,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK analyze select f from t1 where f in (77, 1, 144, 73, 14, 12); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 20 20.00 10.00 10.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 20.00 10.00 10.00 Using where drop table t1; # # Test that histograms over BIT fields use hex diff --git a/mysql-test/main/statistics_upgrade_not_done.result b/mysql-test/main/statistics_upgrade_not_done.result index 902bf25c242..04cc8f4fc4b 100644 --- a/mysql-test/main/statistics_upgrade_not_done.result +++ b/mysql-test/main/statistics_upgrade_not_done.result @@ -21,15 +21,15 @@ INSERT INTO mysql.column_stats VALUES ('test','t0','a','0','9',0.0000,4.0000,1.0000,5,'DOUBLE_PREC_HB', x'5555AAAA00'); flush tables; analyze select * from t0 where a<3; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where # restart select hex(histogram) from mysql.column_stats where table_name='t0' and db_name='test'; hex(histogram) 5555AAAA00 analyze select * from t0 where a<3; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where create table t2 (a int); # This currently just pretends that the histogram was collected. analyze table t2 persistent for all; @@ -39,6 +39,6 @@ test.t2 analyze status Table is already up to date select * from mysql.column_stats where table_name='t2' and db_name='test'; db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram analyze select * from t0 where a<3; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 33.33 30.00 Using where +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 10.00 33.33 30.00 Using where drop table t0, t1, t2; diff --git a/mysql-test/main/status.result b/mysql-test/main/status.result index d25cde89ee1..ec8b9f867b7 100644 --- a/mysql-test/main/status.result +++ b/mysql-test/main/status.result @@ -136,8 +136,8 @@ SHOW SESSION STATUS LIKE 'Last_query_cost'; Variable_name Value Last_query_cost 2.402418 EXPLAIN SELECT a FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 SHOW SESSION STATUS LIKE 'Last_query_cost'; Variable_name Value Last_query_cost 2.402418 @@ -149,10 +149,10 @@ SHOW SESSION STATUS LIKE 'Last_query_cost'; Variable_name Value Last_query_cost 0.000000 EXPLAIN SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 UNION t1 ALL NULL NULL NULL NULL 2 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 UNION t1 NULL ALL NULL NULL NULL NULL 2 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL Using filesort SHOW SESSION STATUS LIKE 'Last_query_cost'; Variable_name Value Last_query_cost 0.000000 diff --git a/mysql-test/main/subselect.result b/mysql-test/main/subselect.result index 167382fc328..8bcf8e2752f 100644 --- a/mysql-test/main/subselect.result +++ b/mysql-test/main/subselect.result @@ -11,8 +11,8 @@ select (select 2); (select 2) 2 explain extended select (select 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 select 2 AS `(select 2)` @@ -21,10 +21,10 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2); 1 2 explain extended SELECT (SELECT 1) UNION SELECT (SELECT 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1249 Select 2 was reduced during optimization Note 1249 Select 4 was reduced during optimization @@ -33,11 +33,11 @@ SELECT (SELECT (SELECT 0 UNION SELECT 0)); (SELECT (SELECT 0 UNION SELECT 0)) 0 explain extended SELECT (SELECT (SELECT 0 UNION SELECT 0)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 /* select#1 */ select (/* select#3 */ select 0 union /* select#4 */ select 0) AS `(SELECT (SELECT 0 UNION SELECT 0))` @@ -51,10 +51,10 @@ SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a; SELECT (SELECT a) as a; ERROR 42S22: Reference 'a' not supported (forward reference in item list) EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00 -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 1 100.00 +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 @@ -193,12 +193,12 @@ a b 4 8 3 8 explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using filesort -3 UNION t4 ALL NULL NULL NULL NULL 3 100.00 Using where -4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort +3 UNION t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +4 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (/* select#3 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (/* select#4 */ select max(`test`.`t2`.`a`) * 4 from `test`.`t2`)) select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2; @@ -213,10 +213,10 @@ set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from (select * from t2 where a>1) as tt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (/* select#3 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt` set optimizer_switch=@tmp_optimizer_switch; @@ -234,10 +234,10 @@ b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) 8 4.5000 9 7.5000 explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` @@ -282,9 +282,9 @@ a 6 7 explain extended select * from t3 where a >= any (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2); @@ -322,11 +322,11 @@ select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) NULL 1 2 2 explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 -3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 +3 DEPENDENT UNION t5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 @@ -343,9 +343,9 @@ patient_uq clinic_uq 1 2 2 2 explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index -1 PRIMARY t6 ALL i1 NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t7 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +1 PRIMARY t6 NULL ALL i1 NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq` @@ -377,11 +377,11 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce','test'); INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1'); INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1'); EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index -4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index -2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 -3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index +4 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index +2 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 +3 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index Warnings: Note 1003 /* select#1 */ select 'joce' AS `pseudo`,(/* select#2 */ select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1 SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM @@ -406,14 +406,14 @@ KEY `topic` (`topic`) INSERT INTO t1 (topic,date,pseudo) VALUES ('43506','2002-10-02','joce'),('40143','2002-08-03','joce'); EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03' EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 NULL index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; @@ -430,11 +430,11 @@ SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1; SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1; ERROR 21000: Subquery returns more than 1 row EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL topic 3 NULL 2 100.00 Using index -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL topic 3 NULL 2 100.00 Using index +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 drop table t1; @@ -559,14 +559,14 @@ ERROR 21000: Subquery returns more than 1 row SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1'); ERROR 21000: Subquery returns more than 1 row EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1' EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 /* select#1 */ select 3 AS `numreponse` from `test`.`t1` where 1 drop table t1; @@ -737,8 +737,8 @@ SELECT * FROM t2 WHERE id IN (SELECT 1); id 1 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref id id 5 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref id id 5 const 1 100.00 Using index Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1 @@ -749,18 +749,18 @@ SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1)); id 2 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref id id 5 const 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref id id 5 const 1 100.00 Using where; Using index Warnings: Note 1249 Select 3 was reduced during optimization Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = <cache>(1 + 1) EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL id 5 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`id` AS `id` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(/* select#2 */ select 1 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(1) union /* select#3 */ select 3 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(3)))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); @@ -883,8 +883,8 @@ select 10.5 > ANY (SELECT * from t1); 10.5 > ANY (SELECT * from t1) 1 explain extended select (select a+1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization @@ -906,9 +906,9 @@ a t1.a in (select t2.a from t2) 3 1 4 0 explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +2 SUBQUERY t2 NULL index_subquery a a 5 func 2 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` CREATE TABLE t3 (a int(11) default '0'); @@ -920,10 +920,10 @@ a t1.a in (select t2.a from t2,t3 where t3.a=t2.a) 3 1 4 0 explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL ref_or_null a a 5 func 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` drop table t1,t2,t3; @@ -1160,21 +1160,21 @@ i drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1266,10 +1266,10 @@ create table t1 (a int); insert into t1 values (1), (2), (3); explain extended select a,(select (select rand() from t1 limit 1) from t1 limit 1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 -3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 UNCACHEABLE SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +3 UNCACHEABLE SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,(/* select#2 */ select (/* select#3 */ select rand() from `test`.`t1` limit 1) from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1` drop table t1; @@ -1321,9 +1321,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) 0 EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 /* select#1 */ select <in_optimizer>(0,<exists>(/* select#2 */ select 1 from dual where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); @@ -1331,9 +1331,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) 0 EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 /* select#1 */ select <in_optimizer>(0,<exists>(/* select#2 */ select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; @@ -1376,9 +1376,9 @@ drop table t1; create table t1 (id int not null auto_increment primary key, salary int, key(salary)); insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000); explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref salary salary 5 const 1 100.00 Using where +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (/* select#2 */ select max(`test`.`t1`.`salary`) from `test`.`t1`) drop table t1; @@ -1438,9 +1438,9 @@ a 3 4 explain extended select * from t2 where t2.a in (select a from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1448,9 +1448,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1458,10 +1458,10 @@ a 2 3 explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 -1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 +1 PRIMARY t3 NULL index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a` drop table t1, t2, t3; @@ -1481,9 +1481,9 @@ a 3 4 explain extended select * from t2 where t2.a in (select a from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1491,9 +1491,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1501,10 +1501,10 @@ a 2 3 explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t3 range a a 5 NULL 3 100.00 Using where; Using index -1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t3 NULL range a a 5 NULL 3 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where `test`.`t1`.`b` = `test`.`t3`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a` insert into t1 values (3,31); @@ -1518,9 +1518,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 drop table t0, t1, t2, t3; @@ -1576,8 +1576,8 @@ select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' fr s1 tttt explain extended (select * from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 (select 'tttt' AS `s1` from dual) (select * from t1); @@ -1609,27 +1609,27 @@ a1 0 a2 1 a3 1 explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; @@ -1642,17 +1642,17 @@ a 7 3 explain extended select * from t3 where a >= all (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); a explain extended select * from t3 where a >= some (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1661,49 +1661,49 @@ a 7 3 explain extended select * from t3 where a >= all (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); a explain extended select * from t3 where a >= some (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); a explain extended select * from t3 where NULL >= any (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= any (select b from t2 group by 1); a explain extended select * from t3 where NULL >= any (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= some (select b from t2); a explain extended select * from t3 where NULL >= some (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= some (select b from t2 group by 1); a explain extended select * from t3 where NULL >= some (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 insert into t2 values (2,2), (2,1), (3,3), (3,1); @@ -1712,9 +1712,9 @@ a 6 7 explain extended select * from t3 where a > all (select max(b) from t2 group by a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,<max>(/* select#2 */ select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))) drop table t2, t3; @@ -1761,11 +1761,11 @@ select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1); s1 e explain extended select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 -3 UNION t1 system NULL NULL NULL NULL 1 100.00 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 +3 UNION t1 NULL system NULL NULL NULL NULL 1 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 'e' AS `s1` from dual where 1 drop table t1; @@ -1882,15 +1882,15 @@ id text 11 text11 12 text12 explain extended select * from t1 where id not in (select id from t1 where id < 8); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where -2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 12 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and <cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`)))) explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where -2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY tt NULL ALL NULL NULL NULL NULL 12 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null limit 1))) @@ -1914,19 +1914,19 @@ id text id text id text 1000 text1000 NULL NULL 1000 text1000 1001 text1001 NULL NULL 1000 text1000 explain extended select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE a ALL NULL NULL NULL NULL 14 100.00 -1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 -1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a NULL ALL NULL NULL NULL NULL 14 100.00 +1 SIMPLE b NULL eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 +1 SIMPLE c NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition Warnings: Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id` drop table t1,t2; create table t1 (a int); insert into t1 values (1); explain select benchmark(1000, (select a from t1 where a=sha(rand()))); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 1 drop table t1; create table t1(id int); create table t2(id int); @@ -2424,10 +2424,10 @@ a b 1 2 3 4 explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY up NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` semi join (`test`.`t1`) where 1 @@ -2600,16 +2600,16 @@ create table t1 (a int not null, b int not null, c int, primary key (a,b)); insert into t1 values (1,1,1), (2,2,2), (3,3,3); set @b:= 0; explain select sum(a) from t1 where b > @b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 3 Using where; Using index set @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where drop table t1; connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection root; @@ -2973,22 +2973,22 @@ one two test 10 5 NULL 10 10 NULL explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0') as 'test' from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(/* select#2 */ select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1` explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`flag` = 'N' explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(/* select#2 */ select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1` DROP TABLE t1,t2; @@ -3110,10 +3110,10 @@ test.t1 analyze status OK explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 -1 PRIMARY r const PRIMARY PRIMARY 4 const 1 -2 SUBQUERY t2 range b b 40 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 +1 PRIMARY r NULL const PRIMARY PRIMARY 4 const 1 +2 SUBQUERY t2 NULL range b b 40 NULL 3 Using where SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; @@ -3122,10 +3122,10 @@ a a b explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 -1 PRIMARY r const PRIMARY PRIMARY 4 const 1 -2 SUBQUERY t2 range b b 40 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 +1 PRIMARY r NULL const PRIMARY PRIMARY 4 const 1 +2 SUBQUERY t2 NULL range b b 40 NULL 3 Using index condition SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; @@ -3174,9 +3174,9 @@ INSERT INTO t1 VALUES (NULL); CREATE TABLE t2(a int); INSERT INTO t2 VALUES (1),(2),(3); EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -2 SUBQUERY t1 index_subquery a a 5 func 3 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +2 SUBQUERY t1 NULL index_subquery a a 5 func 3 Using index; Full scan on NULL key SELECT a, a IN (SELECT a FROM t1) FROM t2; a a IN (SELECT a FROM t1) 1 1 @@ -3209,9 +3209,9 @@ a 1 2 EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE DROP TABLE t1; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (2), (4), (1), (3); @@ -3574,10 +3574,10 @@ CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 9 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 Using temporary ALTER TABLE t1 ADD INDEX(a); SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); a b @@ -3586,10 +3586,10 @@ CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL a NULL NULL NULL 9 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 9 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL a NULL NULL NULL 9 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 Using temporary DROP TABLE t1; create table t1( f1 int,f2 int); insert into t1 values (1,1),(2,2); @@ -3709,10 +3709,10 @@ SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 ORDER BY t1.t DESC LIMIT 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index -2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t1 NULL index NULL PRIMARY 13 NULL 11 Using where; Using index +2 SUBQUERY t1 NULL range PRIMARY PRIMARY 13 NULL 6 Using where; Using index SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 @@ -3734,18 +3734,18 @@ WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1))); i explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12)) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b)); insert into t1 (a) values (FLOOR(rand() * 100)); @@ -4213,9 +4213,9 @@ DROP TABLE t1,t2; CREATE TABLE t1 (a int, b int, KEY (a)); INSERT INTO t1 VALUES (1,1),(2,1); EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref a a 5 const 1 Using where; Using index -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref a a 5 const 1 Using where; Using index +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort DROP TABLE t1; CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); INSERT INTO t1 VALUES @@ -4251,9 +4251,9 @@ CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1), (2); EXPLAIN EXTENDED SELECT * FROM (SELECT count(*) FROM t1 GROUP BY a) as res; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `res`.`count(*)` AS `count(*)` from (/* select#2 */ select count(0) AS `count(*)` from `test`.`t1` group by `test`.`t1`.`a`) `res` DROP TABLE t1; @@ -4387,9 +4387,9 @@ a b CREATE INDEX I1 ON t1 (a); CREATE INDEX I2 ON t1 (b); EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL I2 NULL NULL NULL 2 Using where -1 PRIMARY t1 ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1); a b CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10)); @@ -4397,16 +4397,16 @@ INSERT INTO t2 SELECT * FROM t1; CREATE INDEX I1 ON t2 (a); CREATE INDEX I2 ON t2 (b); EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL I2 NULL NULL NULL 2 Using where -1 PRIMARY t2 ref I1 I1 4 test.t2.b 2 Using where; Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL I2 NULL NULL NULL 2 Using where +1 PRIMARY t2 NULL ref I1 I1 4 test.t2.b 2 Using where; Using index; FirstMatch(t2) SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2); a b EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL I2 NULL NULL NULL 2 Using where -1 PRIMARY t1 ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500); a b DROP TABLE t1,t2; @@ -4426,9 +4426,9 @@ EXPLAIN SELECT a AS out_a, MIN(b) FROM t1 t1_outer WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_outer ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer NULL ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 4 Using where SELECT a AS out_a, MIN(b) FROM t1 t1_outer WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) GROUP BY a; @@ -4446,21 +4446,21 @@ SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a)); 2 EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 select 2 AS `2` from `test`.`t1` semi join (`test`.`t2`) where 1 EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION (SELECT 1 FROM t2 WHERE t1.a = t2.a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 @@ -4540,17 +4540,17 @@ INSERT INTO t1 VALUES (1),(2); SET @save_join_cache_level=@@join_cache_level; SET join_cache_level=0; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL const distinct_key distinct_key 4 const 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select 1 AS `1` from <materialize> (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1 EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL const distinct_key distinct_key 4 const 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary Warnings: Note 1003 /* select#1 */ select 1 AS `1` from <materialize> (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` where `test`.`t1`.`a` > 3 group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1 SET join_cache_level=@save_join_cache_level; @@ -4573,8 +4573,8 @@ int_nokey int_key 5 5 0 0 EXPLAIN EXTENDED SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE C ALL NULL NULL NULL NULL 20 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE C NULL ALL NULL NULL NULL NULL 20 100.00 Using where DROP TABLE C; # End of test for bug#45061. # @@ -4595,9 +4595,9 @@ EXPLAIN SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; @@ -4617,10 +4617,10 @@ EXPLAIN SELECT * FROM t2 outr WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) ORDER BY outr.pk; -id select_type table type possible_keys key key_len ref rows Extra -x x outr ALL x x x x x x -x x t1 eq_ref x x x x x x -x x t2 index x x x x x x +id select_type table partitions type possible_keys key key_len ref rows Extra +x x outr x ALL x x x x x x +x x t1 x eq_ref x x x x x x +x x t2 x index x x x x x x # should not crash on debug binaries SELECT * FROM t2 outr WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) @@ -4639,9 +4639,9 @@ SELECT @@session.sql_mode INTO @old_sql_mode; SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1); @@ -4987,10 +4987,10 @@ KEY b_2 (b) INSERT INTO t3 VALUES (1,1,1), (2,32,1), (3,33,1), (4,34,2); explain SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 Using index -1 PRIMARY t3 ref b,b_2 b 5 test.t1.a 1 Using index -2 DEPENDENT SUBQUERY t2 ref b,b_2,c b 10 test.t3.c,test.t1.a 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 Using index +1 PRIMARY t3 NULL ref b,b_2 b 5 test.t1.a 1 Using index +2 DEPENDENT SUBQUERY t2 NULL ref b,b_2,c b 10 test.t3.c,test.t1.a 1 Using where; Using index SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a; a incorrect 1 1 @@ -5685,12 +5685,12 @@ a a explain SELECT * FROM ot1,ot4 WHERE (ot1.a,ot4.a) IN (SELECT it2.a,it3.a FROM it2,it3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot1 ALL NULL NULL NULL NULL 2 -1 PRIMARY ot4 ALL NULL NULL NULL NULL 8 Using join buffer (flat, BNL join) -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -2 MATERIALIZED it2 ALL NULL NULL NULL NULL 4 -2 MATERIALIZED it3 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY ot4 NULL ALL NULL NULL NULL NULL 8 Using join buffer (flat, BNL join) +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED it2 NULL ALL NULL NULL NULL NULL 4 +2 MATERIALIZED it3 NULL ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) DROP TABLE IF EXISTS ot1, ot4, it2, it3; # # Bug#729039: NULL keys used to evaluate subquery @@ -5706,10 +5706,10 @@ a EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 USE INDEX() WHERE t2.a = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a); a @@ -5717,10 +5717,10 @@ a EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 index idx idx 5 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL index idx idx 5 NULL 3 Using index DROP TABLE t1,t2; # # BUG#752992: Wrong results for a subquery with 'semijoin=on' @@ -5736,10 +5736,10 @@ INSERT INTO t2 VALUES (15,4); SET @save_join_cache_level=@@join_cache_level; SET join_cache_level=0; EXPLAIN SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 3 -1 PRIMARY it eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 Using index -1 PRIMARY t2 index NULL PRIMARY 4 NULL 3 Using index; FirstMatch(it) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 3 +1 PRIMARY it NULL eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 Using index +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 3 Using index; FirstMatch(it) SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1); pk i 11 0 @@ -5759,9 +5759,9 @@ EXPLAIN SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; @@ -6002,12 +6002,12 @@ drop view v1; CREATE TABLE t1 (a INT, b INT, INDEX (a)); INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20); EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 5 const 1 EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 SUBQUERY t1 ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 SUBQUERY t1 NULL ref a a 5 const 1 Using index DROP TABLE t1; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6022,10 +6022,10 @@ EXPLAIN SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2 WHERE EXISTS (SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY table1 ALL NULL NULL NULL NULL 2 -1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 Using where; Using index SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2 WHERE EXISTS (SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1); @@ -6078,10 +6078,10 @@ EXPLAIN SELECT col_int_nokey FROM ot WHERE col_varchar_nokey IN (SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot system NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it1 ref idx_cvk_cik idx_cvk_cik 9 const,const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it1 NULL ref idx_cvk_cik idx_cvk_cik 9 const,const 1 Using where; Using index SELECT col_int_nokey FROM ot WHERE col_varchar_nokey IN (SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL); @@ -6091,10 +6091,10 @@ EXPLAIN SELECT col_int_nokey FROM ot WHERE (col_varchar_nokey, 'x') IN (SELECT col_varchar_key, col_varchar_key2 FROM it2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot system NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -2 MATERIALIZED it2 ref idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 const,const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED it2 NULL ref idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 const,const 1 Using where; Using index SELECT col_int_nokey FROM ot WHERE (col_varchar_nokey, 'x') IN (SELECT col_varchar_key, col_varchar_key2 FROM it2); @@ -6138,8 +6138,8 @@ EXPLAIN SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE sq4_alias1 NULL system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6152,9 +6152,9 @@ EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found -2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 0 Const row not found +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6175,9 +6175,9 @@ c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 FROM t2 AS c_sq1_alias1 WHERE (c_sq1_alias1.col_int_nokey != @var2 OR c_sq1_alias1.pk != @var3)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 SELECT sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) @@ -6197,9 +6197,9 @@ c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 FROM t2 AS c_sq1_alias1 WHERE (c_sq1_alias1.col_int_nokey != @var2 OR c_sq1_alias1.pk != @var3)) ) AS alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 SELECT * FROM ( SELECT sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) @@ -6248,10 +6248,10 @@ EXPLAIN SELECT t2.b , t1.c FROM t2 LEFT JOIN t1 ON t1.c < 3 WHERE (t2.b , t1.c) NOT IN (SELECT * from t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t2.b , t1.c FROM t2 LEFT JOIN t1 ON t1.c < 3 WHERE (t2.b, t1.c) NOT IN (SELECT * from t3); @@ -6270,15 +6270,15 @@ INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20); set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED t1 ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED t1 NULL ref a a 5 const 1 set optimizer_switch=@tmp_optimizer_switch; EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 SUBQUERY t1 ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 SUBQUERY t1 NULL ref a a 5 const 1 Using index DROP TABLE t1; # @@ -6407,10 +6407,10 @@ WHERE EXISTS SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY table1 ALL NULL NULL NULL NULL 2 -1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 Using where; Using index DROP TABLE t1,t2; # # lp:826279: assertion failure with GROUP BY a result of subquery @@ -6636,18 +6636,18 @@ INSERT INTO t1 VALUES ('2009-01-01'),('2009-02-02'); set @old_optimizer_switch = @@optimizer_switch; SET @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index -2 DEPENDENT SUBQUERY t1 index_subquery a a 4 func 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 4 func 2 Using index SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); a 2009-01-01 2009-02-02 SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index -2 MATERIALIZED t1 index NULL a 4 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 Using where; Using index +2 MATERIALIZED t1 NULL index NULL a 4 NULL 2 Using index SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); a 2009-01-01 @@ -6698,33 +6698,33 @@ CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; INSERT INTO t2 VALUES (3,'f'); EXPLAIN SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 NULL EXPLAIN SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 0 EXPLAIN SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 1 EXPLAIN SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 0 @@ -6738,12 +6738,12 @@ INSERT INTO t1 VALUES (7),(0); CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; f1 f2 drop table t1,t2; @@ -6755,20 +6755,20 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(7); EXPLAIN SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1; min_a a EXPLAIN SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT UNION t1 NULL ALL NULL NULL NULL NULL 2 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1; min_a a drop table t1; @@ -6827,9 +6827,9 @@ SELECT MAX( alias2.a ) AS field FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR alias1.a = 'y' HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible HAVING -2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 Using index; Using where SELECT MAX( alias2.a ) AS field FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR alias1.a = 'y' @@ -6839,11 +6839,11 @@ EXPLAIN SELECT MAX( alias2.a ) FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index -1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index -1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join) -2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL index a a 19 NULL 11 Using where; Using index +1 PRIMARY alias2 NULL ref a a 19 test.alias1.a 2 Using index +1 PRIMARY alias3 NULL index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 Using index; Using where SELECT MAX( alias2.a ) FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 ); @@ -6861,12 +6861,12 @@ INSERT INTO t2 VALUES (1),(7); EXPLAIN SELECT * FROM t1 WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2)); a1 @@ -6885,13 +6885,13 @@ set @@expensive_subquery_limit= 0; EXPLAIN SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 flush status; SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; @@ -6923,13 +6923,13 @@ set @@expensive_subquery_limit= default; EXPLAIN SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 flush status; SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; @@ -6967,10 +6967,10 @@ CREATE TABLE t2 (b INT PRIMARY KEY); INSERT INTO t2 VALUES (1),(2); EXPLAIN SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1)); a drop table t1,t2; @@ -6989,11 +6989,11 @@ insert into t4 select * from t3; explain SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1 WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL b NULL NULL NULL 2 Using where -1 PRIMARY t3 ref d d 5 test.t2.b 2 Using index -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL b NULL NULL NULL 2 Using where +1 PRIMARY t3 NULL ref d d 5 test.t2.b 2 Using index +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away set @tmp_mdev410=@@global.userstat; set global userstat=on; flush table_statistics; @@ -7021,10 +7021,10 @@ INSERT INTO t1 VALUES (1),(8); CREATE TABLE t2 (b INT, KEY(b)); INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index -2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL range a a 5 NULL 2 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # # MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields @@ -7038,11 +7038,11 @@ INSERT INTO t3 VALUES ('b'),('c'); EXPLAIN SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index -2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index a a 5 NULL 2 Using where; Using index +2 SUBQUERY <subquery3> NULL ALL distinct_key NULL NULL NULL 1 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; a @@ -7055,10 +7055,10 @@ INSERT INTO t1 VALUES (1),(8); CREATE TABLE t2 (b INT, KEY(b)); INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index -2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL range a a 5 NULL 2 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # # MDEV-5991: crash in Item_field::used_tables @@ -7260,13 +7260,13 @@ insert into t1 values (3), (1), (7); create table t2 (b int, index idx(b)); insert into t2 values (2), (5), (3), (2); explain select * from t1 where (select max(b) from t2) = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away drop table t1,t2; # # MDEV-19429: Wrong query result with EXISTS and LIMIT 0 @@ -7278,9 +7278,9 @@ insert into t12 values (1),(2),(3); select * from t10 where exists (select * from t12 order by a limit 0); a explain select * from t10 where exists (select * from t12 order by a limit 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Zero limit +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Zero limit prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)"; set @l=1; execute stmt1 using @l; diff --git a/mysql-test/main/subselect.test b/mysql-test/main/subselect.test index 19c30bd6dc8..3ce896bbc75 100644 --- a/mysql-test/main/subselect.test +++ b/mysql-test/main/subselect.test @@ -3508,7 +3508,7 @@ CREATE TABLE t2 (pk int PRIMARY KEY, int_key int); INSERT INTO t2 VALUES (3,3), (5,NULL), (7,3); --echo # should have eq_ref for t1 ---replace_column 1 x 2 x 5 x 6 x 7 x 8 x 9 x 10 x +--replace_column 1 x 2 x 4 x 6 x 7 x 8 x 9 x 10 x 11 x 12 x EXPLAIN SELECT * FROM t2 outr WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) diff --git a/mysql-test/main/subselect2.result b/mysql-test/main/subselect2.result index 34e6e857d14..eaf333147b3 100644 --- a/mysql-test/main/subselect2.result +++ b/mysql-test/main/subselect2.result @@ -124,15 +124,15 @@ SELECT t2.*, t4.DOCTYPENAME, t1.CONTENTSIZE,t1.MIMETYPE FROM t2 INNER JOIN t4 ON DOCID DOCNAME DOCTYPEID FOLDERID AUTHOR CREATED TITLE SUBTITLE DOCABSTRACT PUBLISHDATE EXPIRATIONDATE LOCKEDBY STATUS PARENTDOCID REPID MODIFIED MODIFIER PUBLISHSTATUS ORIGINATOR DOCTYPENAME CONTENTSIZE MIMETYPE c373e9f5ad07993f3859444553544200 Last Discussion c373e9f5ad079174ff17444553544200 c373e9f5ad0796c0eca4444553544200 Goldilocks 2003-06-09 11:21:06 Title: Last Discussion NULL Setting new abstract and keeping doc checked out 2003-06-09 10:51:26 2003-06-09 10:51:26 NULL NULL NULL 03eea05112b845949f3fd03278b5fe43 2003-06-09 11:21:06 admin 0 NULL Discussion NULL NULL EXPLAIN SELECT t2.*, t4.DOCTYPENAME, t1.CONTENTSIZE,t1.MIMETYPE FROM t2 INNER JOIN t4 ON t2.DOCTYPEID = t4.DOCTYPEID LEFT OUTER JOIN t1 ON t2.DOCID = t1.DOCID WHERE t2.FOLDERID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t3.FOLDERNAME = 'Level1') AND t3.FOLDERNAME = 'Level2') AND t3.FOLDERNAME = 'Level3') AND t3.FOLDERNAME = 'CopiedFolder') AND t3.FOLDERNAME = 'Movie Reviews') AND t2.DOCNAME = 'Last Discussion'; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL DDOCTYPEID_IDX,DFOLDERID_IDX NULL NULL NULL 9 Using where -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 34 test.t2.DOCID 1 -1 PRIMARY t4 eq_ref PRIMARY PRIMARY 34 test.t2.DOCTYPEID 1 -1 PRIMARY t3 eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t2.FOLDERID 1 Using where -1 PRIMARY t3 eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 Using where -1 PRIMARY t3 eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 Using where -1 PRIMARY t3 eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 Using where -1 PRIMARY t3 ref|filter PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX FFOLDERID_IDX|CMFLDRPARNT_IDX 34|35 test.t3.PARENTID 1 (29%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL DDOCTYPEID_IDX,DFOLDERID_IDX NULL NULL NULL 9 Using where +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 34 test.t2.DOCID 1 +1 PRIMARY t4 NULL eq_ref PRIMARY PRIMARY 34 test.t2.DOCTYPEID 1 +1 PRIMARY t3 NULL eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t2.FOLDERID 1 Using where +1 PRIMARY t3 NULL eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 Using where +1 PRIMARY t3 NULL eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 Using where +1 PRIMARY t3 NULL eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 Using where +1 PRIMARY t3 NULL ref|filter PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX FFOLDERID_IDX|CMFLDRPARNT_IDX 34|35 test.t3.PARENTID 1 (29%) Using where; Using rowid filter drop table t1, t2, t3, t4; CREATE TABLE t1 (a int(10) , PRIMARY KEY (a)) Engine=InnoDB; INSERT INTO t1 VALUES (1),(2); @@ -160,19 +160,19 @@ SET @tmp_optimizer_switch=@@optimizer_switch; SET optimizer_switch='materialization=on,in_to_exists=on'; EXPLAIN SELECT * FROM t2,t3 WHERE (2,9) IN (SELECT DISTINCT a,pk FROM t1) OR a = b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index a a 5 NULL 2 Using where; Using index -1 PRIMARY t3 ref b b 5 test.t2.a 2 Using index -2 SUBQUERY t1 const PRIMARY,a PRIMARY 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index a a 5 NULL 2 Using where; Using index +1 PRIMARY t3 NULL ref b b 5 test.t2.a 2 Using index +2 SUBQUERY t1 NULL const PRIMARY,a PRIMARY 4 const 1 Using where SELECT * FROM t2,t3 WHERE (2,9) IN (SELECT DISTINCT a,pk FROM t1) OR a = b; pk a b 0 4 4 EXPLAIN SELECT * FROM t2,t3 WHERE (2,9) IN (SELECT DISTINCT a,pk FROM v1) OR a = b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index a a 5 NULL 2 Using where; Using index -1 PRIMARY t3 ref b b 5 test.t2.a 2 Using index -2 SUBQUERY t1 const PRIMARY,a PRIMARY 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index a a 5 NULL 2 Using where; Using index +1 PRIMARY t3 NULL ref b b 5 test.t2.a 2 Using index +2 SUBQUERY t1 NULL const PRIMARY,a PRIMARY 4 const 1 Using where SELECT * FROM t2,t3 WHERE (2,9) IN (SELECT DISTINCT a,pk FROM v1) OR a = b; pk a b 0 4 4 @@ -255,11 +255,11 @@ SELECT * FROM t1 WHERE c1 NOT IN ( SELECT t2a.c2 FROM t2 AS t2a, t2 AS t2b, t2 AS t2c WHERE t2c.c2 = t2b.c2 AND ( t2a.m = t2b.n OR 0 ) AND ( t2b.m != a OR t2b.m = t2a.m )); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t2a ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t2b ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2c ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2a NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2b NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2c NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`c1` AS `c1` from `test`.`t1` where !<expr_cache><`test`.`t1`.`c1`,`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`c1`,<exists>(/* select#2 */ select `test`.`t2a`.`c2` from `test`.`t2` `t2a` join `test`.`t2` `t2b` join `test`.`t2` `t2c` where (`test`.`t2b`.`m` <> `test`.`t1`.`a` or `test`.`t2b`.`m` = `test`.`t2a`.`m`) and trigcond(<cache>(`test`.`t1`.`c1`) = `test`.`t2a`.`c2` or `test`.`t2a`.`c2` is null) and `test`.`t2c`.`c2` = `test`.`t2b`.`c2` and `test`.`t2b`.`n` = `test`.`t2a`.`m` having trigcond(`test`.`t2a`.`c2` is null)))) @@ -285,9 +285,9 @@ WHERE date < '2012-12-12 12:12:12' AND node_uid in (2085, 2084) ORDER BY mirror_date ASC ) AS calculated_result; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 -2 DERIVED t1 range date date 6 NULL 3 Using index condition; Using where; Rowid-ordered scan; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 +2 DERIVED t1 NULL range date date 6 NULL 3 Using index condition; Using where; Rowid-ordered scan; Using filesort SELECT * FROM ( SELECT node_uid, date, mirror_date, @result := 0 AS result FROM t1 @@ -308,9 +308,9 @@ WHERE date < '2012-12-12 12:12:12' AND node_uid in (2085, 2084) ORDER BY mirror_date ASC ) AS calculated_result; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 -2 DERIVED t1 range date date 6 NULL 3 Using index condition; Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 3 +2 DERIVED t1 NULL range date date 6 NULL 3 Using index condition; Using where; Using filesort SELECT * FROM ( SELECT node_uid, date, mirror_date, @result := 0 AS result FROM t1 @@ -336,11 +336,11 @@ create index idx on t3(a); explain extended select * from t1, t2 left join t3 on ( t2.a = t3.a ) where t1.a = t2.a and ( t1.a = ( select min(a) from t1 ) or 0 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t3 ref idx idx 6 func 2 100.00 Using where; Using index -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ref idx idx 6 func 2 100.00 Using where; Using index +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t1`.`a`) where `test`.`t1`.`a` = (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1`) and `test`.`t2`.`a` = (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1`) select * from t1, t2 left join t3 on ( t2.a = t3.a ) diff --git a/mysql-test/main/subselect3.result b/mysql-test/main/subselect3.result index 299faadeff7..9d355325af3 100644 --- a/mysql-test/main/subselect3.result +++ b/mysql-test/main/subselect3.result @@ -28,18 +28,18 @@ NULL 2 NULL explain extended select a, oref, a in (select max(ie) from t1 where oref=t2.oref group by grp) Z from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = `test`.`t2`.`oref` group by `test`.`t1`.`grp` having trigcond(<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `Z` from `test`.`t2` explain extended select a, oref from t2 where a in (select max(ie) from t1 where oref=t2.oref group by grp); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = `test`.`t2`.`oref` group by `test`.`t1`.`grp` having <cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`))))) @@ -69,9 +69,9 @@ Z set @save_optimizer_switch=@@optimizer_switch; set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off"; explain extended select a in (select max(ie) from t1 where oref=4 group by grp) from t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary Warnings: Note 1003 /* select#1 */ select <expr_cache><`test`.`t3`.`a`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(/* select#2 */ select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = 4 group by `test`.`t1`.`grp` having trigcond(<cache>(`test`.`t3`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3` set @@optimizer_switch=@save_optimizer_switch; @@ -94,9 +94,9 @@ oref a Z 4 NULL 0 explain extended select oref, a, a in (select a from t1 where oref=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 100.00 -2 DEPENDENT SUBQUERY t1 ALL a NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 100.00 +2 DEPENDENT SUBQUERY t1 NULL ALL a NULL NULL NULL 8 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`oref` = `test`.`t2`.`oref` and trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) having trigcond(`test`.`t1`.`a` is null)))) AS `Z` from `test`.`t2` @@ -163,10 +163,10 @@ explain extended select a, oref, t3.a in (select t1.a from t1, t2 where t1.b=t2.a and t2.b=t3.oref) Z from t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 -2 DEPENDENT SUBQUERY t1 ref_or_null a a 5 func 4 100.00 Using where; Full scan on NULL key -2 DEPENDENT SUBQUERY t2 ref a a 5 test.t1.b 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DEPENDENT SUBQUERY t1 NULL ref_or_null a a 5 func 4 100.00 Using where; Full scan on NULL key +2 DEPENDENT SUBQUERY t2 NULL ref a a 5 test.t1.b 1 100.00 Using where Warnings: Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<expr_cache><`test`.`t3`.`a`,`test`.`t3`.`oref`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond(<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) and `test`.`t2`.`a` = `test`.`t1`.`b` having trigcond(`test`.`t1`.`a` is null)))) AS `Z` from `test`.`t3` @@ -191,10 +191,10 @@ explain extended select a, oref, t3.a in (select t1.a from t1, t2 where t1.b=t2.a and t2.b=t3.oref) Z from t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 -2 DEPENDENT SUBQUERY t1 ref a a 4 func 2 100.00 Using where; Full scan on NULL key -2 DEPENDENT SUBQUERY t2 ref a a 4 test.t1.b 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DEPENDENT SUBQUERY t1 NULL ref a a 4 func 2 100.00 Using where; Full scan on NULL key +2 DEPENDENT SUBQUERY t2 NULL ref a a 4 test.t1.b 1 100.00 Using where Warnings: Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<expr_cache><`test`.`t3`.`a`,`test`.`t3`.`oref`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond(<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`) and `test`.`t2`.`a` = `test`.`t1`.`b`))) AS `Z` from `test`.`t3` @@ -216,9 +216,9 @@ This must show a trig_cond: explain extended select a, oref, a in (select count(*) from t1 group by grp having grp=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: Note 1276 Field or reference 't2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select count(0) from `test`.`t1` group by `test`.`t1`.`grp` having `test`.`t1`.`grp` = `test`.`t2`.`oref` and trigcond(<cache>(`test`.`t2`.`a`) = <ref_null_helper>(count(0)))))) AS `Z` from `test`.`t2` @@ -248,9 +248,9 @@ insert into t2 values (NULL,1, 100), (NULL,2, 100); create table t1 (a int, b int, c int, key(a,b)); insert into t1 select 2*A, 2*A, 100 from t3; explain extended select a,b, oref, (a,b) in (select a,b from t1 where c=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 100.00 Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 5 func 2 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a checking NULL where `test`.`t1`.`c` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b` or `test`.`t1`.`b` is null)) having trigcond(`test`.`t1`.`a` is null) and trigcond(`test`.`t1`.`b` is null))))) AS `Z` from `test`.`t2` @@ -264,10 +264,10 @@ explain extended select a,b, oref, (a,b) in (select a,b from t1,t4 where c=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 ref_or_null a a 5 func 2 100.00 Using where; Full scan on NULL key -2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 100 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL ref_or_null a a 5 func 2 100.00 Using where; Full scan on NULL key +2 DEPENDENT SUBQUERY t4 NULL ALL NULL NULL NULL NULL 100 100.00 Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(/* select#2 */ select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where `test`.`t1`.`c` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b` or `test`.`t1`.`b` is null)) having trigcond(`test`.`t1`.`a` is null) and trigcond(`test`.`t1`.`b` is null)))) AS `Z` from `test`.`t2` @@ -310,9 +310,9 @@ oref a b Z new1 10 10 NULL explain extended select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=10 and b=10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 8 100.00 Using where -2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1` or `test`.`t1`.`ie1` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2` or `test`.`t1`.`ie2` is null)) having trigcond(`test`.`t1`.`ie1` is null) and trigcond(`test`.`t1`.`ie2` is null))))) AS `Z` from `test`.`t2` where `test`.`t2`.`a` = 10 and `test`.`t2`.`b` = 10 @@ -419,9 +419,9 @@ aa 1 dd NULL alter table t1 add index idx(ie); explain select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 -2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 +2 DEPENDENT SUBQUERY t1 NULL index_subquery idx idx 5 func 4 Using where; Full scan on NULL key select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2; oref a Z ee NULL NULL @@ -442,9 +442,9 @@ dd NULL alter table t1 drop index idx; alter table t1 add index idx(oref,ie); explain select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 -2 DEPENDENT SUBQUERY t1 ref_or_null idx idx 10 test.t2.oref,func 4 Using where; Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 +2 DEPENDENT SUBQUERY t1 NULL ref_or_null idx idx 10 test.t2.oref,func 4 Using where; Using index; Full scan on NULL key select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2; oref a Z ee NULL NULL @@ -467,9 +467,9 @@ select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by grp having min(ie) > 1) Z from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 -2 DEPENDENT SUBQUERY t1 ref idx idx 5 test.t2.oref 2 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 +2 DEPENDENT SUBQUERY t1 NULL ref idx idx 5 test.t2.oref 2 Using where; Using temporary select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by grp having min(ie) > 1) Z @@ -558,9 +558,9 @@ ff 2 2 dd 1 NULL alter table t1 add index idx(ie1,ie2); explain select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 -2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 +2 DEPENDENT SUBQUERY t1 NULL index_subquery idx idx 5 func 4 Using where; Full scan on NULL key select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2; oref a b Z ee NULL 1 NULL @@ -580,9 +580,9 @@ bb 2 1 dd 1 NULL explain extended select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 100.00 -2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 100.00 +2 DEPENDENT SUBQUERY t1 NULL index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1` or `test`.`t1`.`ie1` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2` or `test`.`t1`.`ie2` is null)) having trigcond(`test`.`t1`.`ie1` is null) and trigcond(`test`.`t1`.`ie2` is null))))) AS `Z` from `test`.`t2` @@ -605,9 +605,9 @@ insert into t2 values ('aa', 1), ('bb', NULL); explain select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 -2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 +2 DEPENDENT SUBQUERY t1 NULL unique_subquery PRIMARY PRIMARY 4 func 1 Using where; Full scan on NULL key select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2; oref a Z ee NULL 0 @@ -628,9 +628,9 @@ bb 2 cc 2 explain select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by grp) Z from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 6 Using where; Using temporary select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by grp) Z from t2; oref a Z ee NULL 0 @@ -711,10 +711,10 @@ INSERT INTO t1 VALUES (1), (NULL), (4); INSERT INTO t2 VALUES (3), (1),(2), (5), (4), (7), (6); EXPLAIN EXTENDED SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t1`.`a` and !<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` where trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) having trigcond(`test`.`t1`.`a` is null)))) SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1)); @@ -734,10 +734,10 @@ EXPLAIN SELECT * FROM t1 WHERE t1.id NOT IN (SELECT t2.id FROM t2,t3 WHERE t3.name='xxx' AND t2.id=t3.id); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 func 1 Using where; Using index; Full scan on NULL key -2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t2.id 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2 NULL eq_ref PRIMARY PRIMARY 4 func 1 Using where; Using index; Full scan on NULL key +2 DEPENDENT SUBQUERY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.id 1 Using where SELECT * FROM t1 WHERE t1.id NOT IN (SELECT t2.id FROM t2,t3 WHERE t3.name='xxx' AND t2.id=t3.id); @@ -768,9 +768,9 @@ a 1 -1 EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2 NULL unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where DROP TABLE t1, t2; set @@optimizer_switch=@save_optimizer_switch; CREATE TABLE t1 (a INT); @@ -848,10 +848,10 @@ x ROW(11, 12) = (SELECT MAX(x), 22) ROW(11, 12) IN (SELECT MAX(x), 22) 11 0 0 # 2nd and 3rd columns should be same EXPLAIN SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 12), ROW(11, 12) IN (SELECT MAX(x), 12) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 12), ROW(11, 12) IN (SELECT MAX(x), 12) FROM t1; x ROW(11, 12) = (SELECT MAX(x), 12) ROW(11, 12) IN (SELECT MAX(x), 12) 1 0 0 @@ -1032,11 +1032,11 @@ set @@optimizer_switch='materialization=off'; update t22 set c = '2005-12-08 15:58:27' where a = 255; explain select t21.* from t21,t22 where t21.a = t22.a and t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t11 ALL NULL NULL NULL NULL 8 Using where; Start temporary; Using temporary; Using filesort -1 PRIMARY t12 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t22 ALL NULL NULL NULL NULL 26 Using where; End temporary; Using join buffer (flat, BNL join) -1 PRIMARY t21 ALL NULL NULL NULL NULL 26 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t11 NULL ALL NULL NULL NULL NULL 8 Using where; Start temporary; Using temporary; Using filesort +1 PRIMARY t12 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t22 NULL ALL NULL NULL NULL NULL 26 Using where; End temporary; Using join buffer (flat, BNL join) +1 PRIMARY t21 NULL ALL NULL NULL NULL NULL 26 Using where; Using join buffer (flat, BNL join) select t21.* from t21,t22 where t21.a = t22.a and t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a; a b c @@ -1048,10 +1048,10 @@ insert into t1 values (0),(1); set @@optimizer_switch='firstmatch=off,materialization=off'; explain select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY X ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY Y ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY Z ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY X NULL ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY Y NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY Z NULL ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X; subq NULL @@ -1065,9 +1065,9 @@ insert into t1 select a+10 from t0; set @@optimizer_switch='firstmatch=off,materialization=off'; insert into t0 values(2); explain select * from t1 where 2 in (select a from t0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 11 Using where; Start temporary; End temporary -1 PRIMARY t1 ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 11 Using where; Start temporary; End temporary +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) select * from t1 where 2 in (select a from t0); a 0 @@ -1093,9 +1093,9 @@ a set @@optimizer_switch=@save_optimizer_switch; set @@optimizer_switch='materialization=off'; explain select * from t1 where 2 in (select a from t0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 11 Using where; FirstMatch -1 PRIMARY t1 ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 11 Using where; FirstMatch +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) select * from t1 where 2 in (select a from t0); a 0 @@ -1124,10 +1124,10 @@ set @@optimizer_switch='materialization=off'; set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; explain select * from (select a from t0) X where a in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11 -1 PRIMARY t1 ALL NULL NULL NULL NULL 20 Using where; FirstMatch(<derived2>); Using join buffer (flat, BNL join) -2 DERIVED t0 ALL NULL NULL NULL NULL 11 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 11 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 Using where; FirstMatch(<derived2>); Using join buffer (flat, BNL join) +2 DERIVED t0 NULL ALL NULL NULL NULL NULL 11 drop table t0, t1; set optimizer_switch=@tmp_optimizer_switch; create table t0 (a int); @@ -1138,17 +1138,17 @@ insert into t1 select * from t1 where kp1 < 20; create table t3 (a int); insert into t3 select A.a + 10*B.a from t0 A, t0 B; explain select * from t3 where a in (select kp1 from t1 where kp1<20); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where -1 PRIMARY t1 ref kp1 kp1 5 test.t3.a 1 Using index; FirstMatch(t3) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 100 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 1 Using index; FirstMatch(t3) create table t4 (pk int primary key); insert into t4 select a from t3; explain select * from t3 where a in (select t1.kp1 from t1,t4 where kp1<20 and t4.pk=t1.c); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where -1 PRIMARY t1 ref kp1 kp1 5 test.t3.a 1 Using where -1 PRIMARY t4 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 Using index; FirstMatch(t3) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 100 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 1 Using where +1 PRIMARY t4 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c 1 Using index; FirstMatch(t3) drop table t1, t3, t4; set @@optimizer_switch=@save_optimizer_switch; create table t1 (a int) as select * from t0 where a < 5; @@ -1156,12 +1156,12 @@ set @save_max_heap_table_size=@@max_heap_table_size; set @@optimizer_switch='firstmatch=off,materialization=off'; set @@max_heap_table_size= 16384; explain select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 -1 PRIMARY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) -1 PRIMARY E ALL NULL NULL NULL NULL 5 Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY D ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) -1 PRIMARY C ALL NULL NULL NULL NULL 10 Using where; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 +1 PRIMARY B NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +1 PRIMARY E NULL ALL NULL NULL NULL NULL 5 Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY D NULL ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +1 PRIMARY C NULL ALL NULL NULL NULL NULL 10 Using where; End temporary; Using join buffer (flat, BNL join) flush status; select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a); count(*) @@ -1179,10 +1179,10 @@ insert into t2 values (1),(2); create table t3 ( a int , filler char(100), key(a)); insert into t3 select A.a + 10*B.a, 'filler' from t0 A, t0 B; explain select * from t3 where a in (select a from t2) and (a > 5 or a < 10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t3 ref a a 5 test.t2.a 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 +1 PRIMARY t3 NULL ref a a 5 test.t2.a 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using where select * from t3 where a in (select a from t2); a filler 1 filler @@ -1197,28 +1197,28 @@ create table t3 (a char(10)); insert into t3 select * from t1; insert into t3 values (1),(2); explain select * from t2 where a in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) explain select * from t2 where a in (select a from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) explain select * from t2 where a in (select a from t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY t3 ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) explain select * from t1 where a in (select a from t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY t3 ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) drop table t1, t2, t3; create table t1 (a decimal); insert into t1 values (1),(2); explain select * from t1 where a in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) drop table t1; set @@optimizer_switch=@save_optimizer_switch; set @@optimizer_switch=@save_optimizer_switch; @@ -1229,45 +1229,45 @@ create table t2 as select * from t1; create table t3 (a int, b int, filler char(100), key(a)); insert into t3 select A.a + 10*B.a, A.a + 10*B.a, 'filler' from t1 A, t1 B, t1 C; explain select * from t1, t3 where t3.a in (select a from t2) and (t3.a < 10 or t3.a >30) and t1.a =3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY t3 ref a a 5 test.t2.a 10 End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ref a a 5 test.t2.a 10 End temporary explain select straight_join * from t1 A, t1 B where A.a in (select a from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where -1 PRIMARY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 Using where +1 PRIMARY B NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 10 Using where explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY A NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY A NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) explain select straight_join * from t2 X, t2 Y where X.a in (select straight_join A.a from t1 A, t1 B); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY X ALL NULL NULL NULL NULL 10 Using where -1 PRIMARY Y ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY X NULL ALL NULL NULL NULL NULL 10 Using where +1 PRIMARY Y NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY A NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) create table t0 (a int, b int); insert into t0 values(1,1); explain select * from t0, t3 where t3.a in (select a from t2) and (t3.a < 10 or t3.a >30); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where; Start temporary -1 PRIMARY t3 ref a a 5 test.t2.a 10 End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 Using where; Start temporary +1 PRIMARY t3 NULL ref a a 5 test.t2.a 10 End temporary create table t4 as select a as x, a as y from t1; explain select * from t0, t3 where (t3.a, t3.b) in (select x,y from t4) and (t3.a < 10 or t3.a >30); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 system NULL NULL NULL NULL 1 -1 PRIMARY t4 ALL NULL NULL NULL NULL 10 Using where; Start temporary -1 PRIMARY t3 ref a a 5 test.t4.x 10 Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 10 Using where; Start temporary +1 PRIMARY t3 NULL ref a a 5 test.t4.x 10 Using where; End temporary drop table t0,t1,t2,t3,t4; create table t0 (a int); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -1275,13 +1275,13 @@ create table t1 (a int, b int, filler char(100), key(a,b)); insert into t1 select A.a, B.a, 'filler' from t0 A, t0 B; create table t2 as select * from t1; explain select * from t2 where a in (select b from t1 where a=3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 100 Using where -1 PRIMARY t1 ref a a 10 const,test.t2.a 1 Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 100 Using where +1 PRIMARY t1 NULL ref a a 10 const,test.t2.a 1 Using index; FirstMatch(t2) explain select * from t2 where (b,a) in (select a,b from t1 where a=3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 100 Using where -1 PRIMARY t1 ref a a 10 const,test.t2.a 1 Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 100 Using where +1 PRIMARY t1 NULL ref a a 10 const,test.t2.a 1 Using index; FirstMatch(t2) drop table t1,t2; set @@optimizer_switch=@save_optimizer_switch; create table t1 (a int, b int); @@ -1290,17 +1290,17 @@ create table t2 (a int, b int); insert into t2 select A.a + 10*B.a, A.a + 10*B.a from t0 A, t0 B; set @@optimizer_switch='firstmatch=off,materialization=off'; explain select * from t1 where (a,b) in (select a,b from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 -1 PRIMARY t2 ALL NULL NULL NULL NULL 100 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 100 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) set @save_optimizer_search_depth=@@optimizer_search_depth; set @@optimizer_search_depth=63; Warnings: Warning 1292 Truncated incorrect optimizer_search_depth value: '63' explain select * from t1 where (a,b) in (select a,b from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 -1 PRIMARY t2 ALL NULL NULL NULL NULL 100 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 100 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) set @@optimizer_search_depth=@save_optimizer_search_depth; set @@optimizer_switch=@save_optimizer_switch; drop table t0, t1, t2; @@ -1310,9 +1310,9 @@ insert into t0 values (10.24), (22.11); create table t1 as select * from t0; insert into t1 select * from t0; explain select * from t0 where a in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; FirstMatch(t0); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; FirstMatch(t0); Using join buffer (flat, BNL join) select * from t0 where a in (select a from t1); a 10.24 @@ -1323,9 +1323,9 @@ insert into t0 values ('2008-01-01'),('2008-02-02'); create table t1 as select * from t0; insert into t1 select * from t0; explain select * from t0 where a in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; FirstMatch(t0); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; FirstMatch(t0); Using join buffer (flat, BNL join) select * from t0 where a in (select a from t1); a 2008-01-01 @@ -1337,11 +1337,11 @@ create table t1 as select a as a, a as b, a as c from t0 where a < 3; create table t2 as select a as a, a as b from t0 where a < 3; insert into t2 select * from t2; explain select * from t1 where (a,b,c) in (select X.a, Y.a, Z.a from t2 X, t2 Y, t2 Z where X.b=33); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY X ALL NULL NULL NULL NULL 6 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY Y ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) -1 PRIMARY Z ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY X NULL ALL NULL NULL NULL NULL 6 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY Y NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +1 PRIMARY Z NULL ALL NULL NULL NULL NULL 6 Using where; End temporary; Using join buffer (flat, BNL join) drop table t0,t1,t2; set @@optimizer_switch=@save_optimizer_switch; @@ -1413,10 +1413,10 @@ WHERE a.idIndividual IN INNER JOIN t2 c ON c.idContact=cona.idContact WHERE cona.postalStripped='T2H3B2' ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY cona ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary -1 PRIMARY c eq_ref PRIMARY PRIMARY 4 test.cona.idContact 1 100.00 Using where -1 PRIMARY a eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY cona NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary +1 PRIMARY c NULL eq_ref PRIMARY PRIMARY 4 test.cona.idContact 1 100.00 Using where +1 PRIMARY a NULL eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary Warnings: Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where `test`.`cona`.`postalStripped` = 'T2H3B2' and `test`.`a`.`idIndividual` = `test`.`c`.`idObj` and `test`.`c`.`idContact` = `test`.`cona`.`idContact` set @@optimizer_switch=@save_optimizer_switch; @@ -1476,10 +1476,10 @@ WHERE ( SELECT b FROM t3 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 SELECT * FROM t1 @@ -1536,9 +1536,9 @@ SELECT i, v, (SELECT COUNT(DISTINCT i) FROM t1 WHERE v = t2.v) as subsel FROM t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.v' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`i` AS `i`,`test`.`t2`.`v` AS `v`,<expr_cache><`test`.`t2`.`v`>((/* select#2 */ select count(distinct `test`.`t1`.`i`) from `test`.`t1` where `test`.`t1`.`v` = `test`.`t2`.`v`)) AS `subsel` from `test`.`t2` diff --git a/mysql-test/main/subselect3_jcl6.result b/mysql-test/main/subselect3_jcl6.result index aebeb4e0cc1..e5c19da69f4 100644 --- a/mysql-test/main/subselect3_jcl6.result +++ b/mysql-test/main/subselect3_jcl6.result @@ -31,18 +31,18 @@ NULL 2 NULL explain extended select a, oref, a in (select max(ie) from t1 where oref=t2.oref group by grp) Z from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = `test`.`t2`.`oref` group by `test`.`t1`.`grp` having trigcond(<cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `Z` from `test`.`t2` explain extended select a, oref from t2 where a in (select max(ie) from t1 where oref=t2.oref group by grp); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = `test`.`t2`.`oref` group by `test`.`t1`.`grp` having <cache>(`test`.`t2`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`))))) @@ -72,9 +72,9 @@ Z set @save_optimizer_switch=@@optimizer_switch; set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off"; explain extended select a in (select max(ie) from t1 where oref=4 group by grp) from t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using temporary Warnings: Note 1003 /* select#1 */ select <expr_cache><`test`.`t3`.`a`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(/* select#2 */ select max(`test`.`t1`.`ie`) from `test`.`t1` where `test`.`t1`.`oref` = 4 group by `test`.`t1`.`grp` having trigcond(<cache>(`test`.`t3`.`a`) = <ref_null_helper>(max(`test`.`t1`.`ie`)))))) AS `a in (select max(ie) from t1 where oref=4 group by grp)` from `test`.`t3` set @@optimizer_switch=@save_optimizer_switch; @@ -97,9 +97,9 @@ oref a Z 4 NULL 0 explain extended select oref, a, a in (select a from t1 where oref=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 100.00 -2 DEPENDENT SUBQUERY t1 ALL a NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 100.00 +2 DEPENDENT SUBQUERY t1 NULL ALL a NULL NULL NULL 8 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`oref` = `test`.`t2`.`oref` and trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) having trigcond(`test`.`t1`.`a` is null)))) AS `Z` from `test`.`t2` @@ -166,10 +166,10 @@ explain extended select a, oref, t3.a in (select t1.a from t1, t2 where t1.b=t2.a and t2.b=t3.oref) Z from t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 -2 DEPENDENT SUBQUERY t1 ref_or_null a a 5 func 4 100.00 Using where; Full scan on NULL key -2 DEPENDENT SUBQUERY t2 ref a a 5 test.t1.b 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DEPENDENT SUBQUERY t1 NULL ref_or_null a a 5 func 4 100.00 Using where; Full scan on NULL key +2 DEPENDENT SUBQUERY t2 NULL ref a a 5 test.t1.b 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<expr_cache><`test`.`t3`.`a`,`test`.`t3`.`oref`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond(<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) and `test`.`t2`.`a` = `test`.`t1`.`b` having trigcond(`test`.`t1`.`a` is null)))) AS `Z` from `test`.`t3` @@ -194,10 +194,10 @@ explain extended select a, oref, t3.a in (select t1.a from t1, t2 where t1.b=t2.a and t2.b=t3.oref) Z from t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 -2 DEPENDENT SUBQUERY t1 ref a a 4 func 2 100.00 Using where; Full scan on NULL key -2 DEPENDENT SUBQUERY t2 ref a a 4 test.t1.b 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DEPENDENT SUBQUERY t1 NULL ref a a 4 func 2 100.00 Using where; Full scan on NULL key +2 DEPENDENT SUBQUERY t2 NULL ref a a 4 test.t1.b 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1276 Field or reference 'test.t3.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`oref` AS `oref`,<expr_cache><`test`.`t3`.`a`,`test`.`t3`.`oref`>(<in_optimizer>(`test`.`t3`.`a`,<exists>(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t3`.`oref` and trigcond(<cache>(`test`.`t3`.`a`) = `test`.`t1`.`a`) and `test`.`t2`.`a` = `test`.`t1`.`b`))) AS `Z` from `test`.`t3` @@ -219,9 +219,9 @@ This must show a trig_cond: explain extended select a, oref, a in (select count(*) from t1 group by grp having grp=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: Note 1276 Field or reference 't2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`oref`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select count(0) from `test`.`t1` group by `test`.`t1`.`grp` having `test`.`t1`.`grp` = `test`.`t2`.`oref` and trigcond(<cache>(`test`.`t2`.`a`) = <ref_null_helper>(count(0)))))) AS `Z` from `test`.`t2` @@ -251,9 +251,9 @@ insert into t2 values (NULL,1, 100), (NULL,2, 100); create table t1 (a int, b int, c int, key(a,b)); insert into t1 select 2*A, 2*A, 100 from t3; explain extended select a,b, oref, (a,b) in (select a,b from t1 where c=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 100.00 Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 5 func 2 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a checking NULL where `test`.`t1`.`c` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b` or `test`.`t1`.`b` is null)) having trigcond(`test`.`t1`.`a` is null) and trigcond(`test`.`t1`.`b` is null))))) AS `Z` from `test`.`t2` @@ -267,10 +267,10 @@ explain extended select a,b, oref, (a,b) in (select a,b from t1,t4 where c=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 ref_or_null a a 5 func 2 100.00 Using where; Full scan on NULL key -2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 100 100.00 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL ref_or_null a a 5 func 2 100.00 Using where; Full scan on NULL key +2 DEPENDENT SUBQUERY t4 NULL ALL NULL NULL NULL NULL 100 100.00 Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`oref` AS `oref`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(/* select#2 */ select `test`.`t1`.`a`,`test`.`t1`.`b` from `test`.`t1` join `test`.`t4` where `test`.`t1`.`c` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`b` or `test`.`t1`.`b` is null)) having trigcond(`test`.`t1`.`a` is null) and trigcond(`test`.`t1`.`b` is null)))) AS `Z` from `test`.`t2` @@ -313,9 +313,9 @@ oref a b Z new1 10 10 NULL explain extended select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=10 and b=10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 8 100.00 Using where -2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1` or `test`.`t1`.`ie1` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2` or `test`.`t1`.`ie2` is null)) having trigcond(`test`.`t1`.`ie1` is null) and trigcond(`test`.`t1`.`ie2` is null))))) AS `Z` from `test`.`t2` where `test`.`t2`.`a` = 10 and `test`.`t2`.`b` = 10 @@ -422,9 +422,9 @@ aa 1 dd NULL alter table t1 add index idx(ie); explain select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 -2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 +2 DEPENDENT SUBQUERY t1 NULL index_subquery idx idx 5 func 4 Using where; Full scan on NULL key select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2; oref a Z ee NULL NULL @@ -445,9 +445,9 @@ dd NULL alter table t1 drop index idx; alter table t1 add index idx(oref,ie); explain select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 -2 DEPENDENT SUBQUERY t1 ref_or_null idx idx 10 test.t2.oref,func 4 Using where; Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 +2 DEPENDENT SUBQUERY t1 NULL ref_or_null idx idx 10 test.t2.oref,func 4 Using where; Using index; Full scan on NULL key select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2; oref a Z ee NULL NULL @@ -470,9 +470,9 @@ select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by grp having min(ie) > 1) Z from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 -2 DEPENDENT SUBQUERY t1 ref idx idx 5 test.t2.oref 2 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 +2 DEPENDENT SUBQUERY t1 NULL ref idx idx 5 test.t2.oref 2 Using where; Using temporary select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by grp having min(ie) > 1) Z @@ -561,9 +561,9 @@ ff 2 2 dd 1 NULL alter table t1 add index idx(ie1,ie2); explain select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 -2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 +2 DEPENDENT SUBQUERY t1 NULL index_subquery idx idx 5 func 4 Using where; Full scan on NULL key select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2; oref a b Z ee NULL 1 NULL @@ -583,9 +583,9 @@ bb 2 1 dd 1 NULL explain extended select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 100.00 -2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 100.00 +2 DEPENDENT SUBQUERY t1 NULL index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key Warnings: Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where `test`.`t1`.`oref` = `test`.`t2`.`oref` and trigcond(trigcond(<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1` or `test`.`t1`.`ie1` is null)) and trigcond(trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2` or `test`.`t1`.`ie2` is null)) having trigcond(`test`.`t1`.`ie1` is null) and trigcond(`test`.`t1`.`ie2` is null))))) AS `Z` from `test`.`t2` @@ -608,9 +608,9 @@ insert into t2 values ('aa', 1), ('bb', NULL); explain select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 -2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 +2 DEPENDENT SUBQUERY t1 NULL unique_subquery PRIMARY PRIMARY 4 func 1 Using where; Full scan on NULL key select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2; oref a Z ee NULL 0 @@ -631,9 +631,9 @@ bb 2 cc 2 explain select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by grp) Z from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 6 Using where; Using temporary select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by grp) Z from t2; oref a Z ee NULL 0 @@ -714,10 +714,10 @@ INSERT INTO t1 VALUES (1), (NULL), (4); INSERT INTO t2 VALUES (3), (1),(2), (5), (4), (7), (6); EXPLAIN EXTENDED SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`b` = `test`.`t1`.`a` and !<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` where trigcond(<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a` or `test`.`t1`.`a` is null) having trigcond(`test`.`t1`.`a` is null)))) SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1)); @@ -737,10 +737,10 @@ EXPLAIN SELECT * FROM t1 WHERE t1.id NOT IN (SELECT t2.id FROM t2,t3 WHERE t3.name='xxx' AND t2.id=t3.id); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 func 1 Using where; Using index; Full scan on NULL key -2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t2.id 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2 NULL eq_ref PRIMARY PRIMARY 4 func 1 Using where; Using index; Full scan on NULL key +2 DEPENDENT SUBQUERY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.id 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT * FROM t1 WHERE t1.id NOT IN (SELECT t2.id FROM t2,t3 WHERE t3.name='xxx' AND t2.id=t3.id); @@ -771,9 +771,9 @@ a 1 -1 EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2 NULL unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where DROP TABLE t1, t2; set @@optimizer_switch=@save_optimizer_switch; CREATE TABLE t1 (a INT); @@ -851,10 +851,10 @@ x ROW(11, 12) = (SELECT MAX(x), 22) ROW(11, 12) IN (SELECT MAX(x), 22) 11 0 0 # 2nd and 3rd columns should be same EXPLAIN SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 12), ROW(11, 12) IN (SELECT MAX(x), 12) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 12), ROW(11, 12) IN (SELECT MAX(x), 12) FROM t1; x ROW(11, 12) = (SELECT MAX(x), 12) ROW(11, 12) IN (SELECT MAX(x), 12) 1 0 0 @@ -1035,11 +1035,11 @@ set @@optimizer_switch='materialization=off'; update t22 set c = '2005-12-08 15:58:27' where a = 255; explain select t21.* from t21,t22 where t21.a = t22.a and t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t11 ALL NULL NULL NULL NULL 8 Using where; Start temporary; Using temporary; Using filesort -1 PRIMARY t12 hash_ALL NULL #hash#$hj 4 test.t11.a 8 Using where; Using join buffer (flat, BNLH join) -1 PRIMARY t22 hash_ALL NULL #hash#$hj 4 test.t11.a 26 Using where; End temporary; Using join buffer (incremental, BNLH join) -1 PRIMARY t21 hash_ALL NULL #hash#$hj 4 test.t11.a 26 Using where; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t11 NULL ALL NULL NULL NULL NULL 8 Using where; Start temporary; Using temporary; Using filesort +1 PRIMARY t12 NULL hash_ALL NULL #hash#$hj 4 test.t11.a 8 Using where; Using join buffer (flat, BNLH join) +1 PRIMARY t22 NULL hash_ALL NULL #hash#$hj 4 test.t11.a 26 Using where; End temporary; Using join buffer (incremental, BNLH join) +1 PRIMARY t21 NULL hash_ALL NULL #hash#$hj 4 test.t11.a 26 Using where; Using join buffer (incremental, BNLH join) select t21.* from t21,t22 where t21.a = t22.a and t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a; a b c @@ -1051,10 +1051,10 @@ insert into t1 values (0),(1); set @@optimizer_switch='firstmatch=off,materialization=off'; explain select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY X ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY Y ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY Z hash_ALL NULL #hash#$hj 5 test.Y.a 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY X NULL ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY Y NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY Z NULL hash_ALL NULL #hash#$hj 5 test.Y.a 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X; subq NULL @@ -1068,9 +1068,9 @@ insert into t1 select a+10 from t0; set @@optimizer_switch='firstmatch=off,materialization=off'; insert into t0 values(2); explain select * from t1 where 2 in (select a from t0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 11 Using where; Start temporary; End temporary -1 PRIMARY t1 ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 11 Using where; Start temporary; End temporary +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) select * from t1 where 2 in (select a from t0); a 0 @@ -1096,9 +1096,9 @@ a set @@optimizer_switch=@save_optimizer_switch; set @@optimizer_switch='materialization=off'; explain select * from t1 where 2 in (select a from t0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 11 Using where; FirstMatch -1 PRIMARY t1 ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 11 Using where; FirstMatch +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) select * from t1 where 2 in (select a from t0); a 0 @@ -1127,10 +1127,10 @@ set @@optimizer_switch='materialization=off'; set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; explain select * from (select a from t0) X where a in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 11 -1 PRIMARY t1 ALL NULL NULL NULL NULL 20 Using where; FirstMatch(<derived2>); Using join buffer (flat, BNL join) -2 DERIVED t0 ALL NULL NULL NULL NULL 11 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 11 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 Using where; FirstMatch(<derived2>); Using join buffer (flat, BNL join) +2 DERIVED t0 NULL ALL NULL NULL NULL NULL 11 drop table t0, t1; set optimizer_switch=@tmp_optimizer_switch; create table t0 (a int); @@ -1141,17 +1141,17 @@ insert into t1 select * from t1 where kp1 < 20; create table t3 (a int); insert into t3 select A.a + 10*B.a from t0 A, t0 B; explain select * from t3 where a in (select kp1 from t1 where kp1<20); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where -1 PRIMARY t1 ref kp1 kp1 5 test.t3.a 1 Using index; FirstMatch(t3) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 100 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 1 Using index; FirstMatch(t3) create table t4 (pk int primary key); insert into t4 select a from t3; explain select * from t3 where a in (select t1.kp1 from t1,t4 where kp1<20 and t4.pk=t1.c); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where -1 PRIMARY t1 ref kp1 kp1 5 test.t3.a 1 Using where -1 PRIMARY t4 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 Using index; FirstMatch(t3) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 100 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 1 Using where +1 PRIMARY t4 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c 1 Using index; FirstMatch(t3) drop table t1, t3, t4; set @@optimizer_switch=@save_optimizer_switch; create table t1 (a int) as select * from t0 where a < 5; @@ -1159,12 +1159,12 @@ set @save_max_heap_table_size=@@max_heap_table_size; set @@optimizer_switch='firstmatch=off,materialization=off'; set @@max_heap_table_size= 16384; explain select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 -1 PRIMARY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) -1 PRIMARY E ALL NULL NULL NULL NULL 5 Using where; Start temporary; Using join buffer (incremental, BNL join) -1 PRIMARY D hash_ALL NULL #hash#$hj 5 test.E.a 10 Using where; Using join buffer (incremental, BNLH join) -1 PRIMARY C ALL NULL NULL NULL NULL 10 Using where; End temporary; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 +1 PRIMARY B NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +1 PRIMARY E NULL ALL NULL NULL NULL NULL 5 Using where; Start temporary; Using join buffer (incremental, BNL join) +1 PRIMARY D NULL hash_ALL NULL #hash#$hj 5 test.E.a 10 Using where; Using join buffer (incremental, BNLH join) +1 PRIMARY C NULL ALL NULL NULL NULL NULL 10 Using where; End temporary; Using join buffer (incremental, BNL join) flush status; select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a); count(*) @@ -1182,10 +1182,10 @@ insert into t2 values (1),(2); create table t3 ( a int , filler char(100), key(a)); insert into t3 select A.a + 10*B.a, 'filler' from t0 A, t0 B; explain select * from t3 where a in (select a from t2) and (a > 5 or a < 10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t3 ref a a 5 test.t2.a 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 +1 PRIMARY t3 NULL ref a a 5 test.t2.a 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using where select * from t3 where a in (select a from t2); a filler 1 filler @@ -1200,28 +1200,28 @@ create table t3 (a char(10)); insert into t3 select * from t1; insert into t3 values (1),(2); explain select * from t2 where a in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY t1 hash_ALL NULL #hash#$hj 4 test.t2.a 4 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL hash_ALL NULL #hash#$hj 4 test.t2.a 4 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) explain select * from t2 where a in (select a from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY t2 hash_ALL NULL #hash#$hj 5 test.t2.a 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY t2 NULL hash_ALL NULL #hash#$hj 5 test.t2.a 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) explain select * from t2 where a in (select a from t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY t3 ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) explain select * from t1 where a in (select a from t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY t3 ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) drop table t1, t2, t3; create table t1 (a decimal); insert into t1 values (1),(2); explain select * from t1 where a in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY t1 hash_ALL NULL #hash#$hj 6 test.t1.a 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL hash_ALL NULL #hash#$hj 6 test.t1.a 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) drop table t1; set @@optimizer_switch=@save_optimizer_switch; set @@optimizer_switch=@save_optimizer_switch; @@ -1232,45 +1232,45 @@ create table t2 as select * from t1; create table t3 (a int, b int, filler char(100), key(a)); insert into t3 select A.a + 10*B.a, A.a + 10*B.a, 'filler' from t1 A, t1 B, t1 C; explain select * from t1, t3 where t3.a in (select a from t2) and (t3.a < 10 or t3.a >30) and t1.a =3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY t3 ref a a 5 test.t2.a 10 End temporary; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ref a a 5 test.t2.a 10 End temporary; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan explain select straight_join * from t1 A, t1 B where A.a in (select a from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where -1 PRIMARY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 Using where +1 PRIMARY B NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 10 Using where explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY A NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY A NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) explain select straight_join * from t2 X, t2 Y where X.a in (select straight_join A.a from t1 A, t1 B); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY X ALL NULL NULL NULL NULL 10 Using where -1 PRIMARY Y ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 10 Using where -2 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY X NULL ALL NULL NULL NULL NULL 10 Using where +1 PRIMARY Y NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY A NULL ALL NULL NULL NULL NULL 10 Using where +2 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) create table t0 (a int, b int); insert into t0 values(1,1); explain select * from t0, t3 where t3.a in (select a from t2) and (t3.a < 10 or t3.a >30); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where; Start temporary -1 PRIMARY t3 ref a a 5 test.t2.a 10 End temporary; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 Using where; Start temporary +1 PRIMARY t3 NULL ref a a 5 test.t2.a 10 End temporary; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan create table t4 as select a as x, a as y from t1; explain select * from t0, t3 where (t3.a, t3.b) in (select x,y from t4) and (t3.a < 10 or t3.a >30); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 system NULL NULL NULL NULL 1 -1 PRIMARY t4 ALL NULL NULL NULL NULL 10 Using where; Start temporary -1 PRIMARY t3 ref a a 5 test.t4.x 10 Using where; End temporary; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 10 Using where; Start temporary +1 PRIMARY t3 NULL ref a a 5 test.t4.x 10 Using where; End temporary; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan drop table t0,t1,t2,t3,t4; create table t0 (a int); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -1278,13 +1278,13 @@ create table t1 (a int, b int, filler char(100), key(a,b)); insert into t1 select A.a, B.a, 'filler' from t0 A, t0 B; create table t2 as select * from t1; explain select * from t2 where a in (select b from t1 where a=3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 100 Using where -1 PRIMARY t1 ref a a 10 const,test.t2.a 1 Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 100 Using where +1 PRIMARY t1 NULL ref a a 10 const,test.t2.a 1 Using index; FirstMatch(t2) explain select * from t2 where (b,a) in (select a,b from t1 where a=3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 100 Using where -1 PRIMARY t1 ref a a 10 const,test.t2.a 1 Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 100 Using where +1 PRIMARY t1 NULL ref a a 10 const,test.t2.a 1 Using index; FirstMatch(t2) drop table t1,t2; set @@optimizer_switch=@save_optimizer_switch; create table t1 (a int, b int); @@ -1293,17 +1293,17 @@ create table t2 (a int, b int); insert into t2 select A.a + 10*B.a, A.a + 10*B.a from t0 A, t0 B; set @@optimizer_switch='firstmatch=off,materialization=off'; explain select * from t1 where (a,b) in (select a,b from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where -1 PRIMARY t2 hash_ALL NULL #hash#$hj 10 test.t1.a,test.t1.b 100 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 Using where +1 PRIMARY t2 NULL hash_ALL NULL #hash#$hj 10 test.t1.a,test.t1.b 100 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) set @save_optimizer_search_depth=@@optimizer_search_depth; set @@optimizer_search_depth=63; Warnings: Warning 1292 Truncated incorrect optimizer_search_depth value: '63' explain select * from t1 where (a,b) in (select a,b from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where -1 PRIMARY t2 hash_ALL NULL #hash#$hj 10 test.t1.a,test.t1.b 100 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 Using where +1 PRIMARY t2 NULL hash_ALL NULL #hash#$hj 10 test.t1.a,test.t1.b 100 Using where; Start temporary; End temporary; Using join buffer (flat, BNLH join) set @@optimizer_search_depth=@save_optimizer_search_depth; set @@optimizer_switch=@save_optimizer_switch; drop table t0, t1, t2; @@ -1313,9 +1313,9 @@ insert into t0 values (10.24), (22.11); create table t1 as select * from t0; insert into t1 select * from t0; explain select * from t0 where a in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; FirstMatch(t0); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; FirstMatch(t0); Using join buffer (flat, BNL join) select * from t0 where a in (select a from t1); a 10.24 @@ -1326,9 +1326,9 @@ insert into t0 values ('2008-01-01'),('2008-02-02'); create table t1 as select * from t0; insert into t1 select * from t0; explain select * from t0 where a in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; FirstMatch(t0); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; FirstMatch(t0); Using join buffer (flat, BNL join) select * from t0 where a in (select a from t1); a 2008-01-01 @@ -1340,11 +1340,11 @@ create table t1 as select a as a, a as b, a as c from t0 where a < 3; create table t2 as select a as a, a as b from t0 where a < 3; insert into t2 select * from t2; explain select * from t1 where (a,b,c) in (select X.a, Y.a, Z.a from t2 X, t2 Y, t2 Z where X.b=33); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY X hash_ALL NULL #hash#$hj 5 test.t1.a 6 Using where; Start temporary; Using join buffer (flat, BNLH join) -1 PRIMARY Y hash_ALL NULL #hash#$hj 5 test.t1.b 6 Using where; Using join buffer (incremental, BNLH join) -1 PRIMARY Z hash_ALL NULL #hash#$hj 5 test.t1.c 6 Using where; End temporary; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY X NULL hash_ALL NULL #hash#$hj 5 test.t1.a 6 Using where; Start temporary; Using join buffer (flat, BNLH join) +1 PRIMARY Y NULL hash_ALL NULL #hash#$hj 5 test.t1.b 6 Using where; Using join buffer (incremental, BNLH join) +1 PRIMARY Z NULL hash_ALL NULL #hash#$hj 5 test.t1.c 6 Using where; End temporary; Using join buffer (incremental, BNLH join) drop table t0,t1,t2; set @@optimizer_switch=@save_optimizer_switch; @@ -1416,10 +1416,10 @@ WHERE a.idIndividual IN INNER JOIN t2 c ON c.idContact=cona.idContact WHERE cona.postalStripped='T2H3B2' ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY cona ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary -1 PRIMARY c eq_ref PRIMARY PRIMARY 4 test.cona.idContact 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 PRIMARY a eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY cona NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary +1 PRIMARY c NULL eq_ref PRIMARY PRIMARY 4 test.cona.idContact 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY a NULL eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary Warnings: Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where `test`.`cona`.`postalStripped` = 'T2H3B2' and `test`.`a`.`idIndividual` = `test`.`c`.`idObj` and `test`.`c`.`idContact` = `test`.`cona`.`idContact` set @@optimizer_switch=@save_optimizer_switch; @@ -1479,10 +1479,10 @@ WHERE ( SELECT b FROM t3 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 SELECT * FROM t1 @@ -1539,9 +1539,9 @@ SELECT i, v, (SELECT COUNT(DISTINCT i) FROM t1 WHERE v = t2.v) as subsel FROM t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.v' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`i` AS `i`,`test`.`t2`.`v` AS `v`,<expr_cache><`test`.`t2`.`v`>((/* select#2 */ select count(distinct `test`.`t1`.`i`) from `test`.`t1` where `test`.`t1`.`v` = `test`.`t2`.`v`)) AS `subsel` from `test`.`t2` diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result index 6bcdcf1fe74..27b50503c95 100644 --- a/mysql-test/main/subselect4.result +++ b/mysql-test/main/subselect4.result @@ -18,10 +18,10 @@ EXPLAIN SELECT 1 FROM t1 WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3)) ORDER BY count(*); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 5 NULL 2 Using index -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 5 NULL 2 Using index +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT SUBQUERY t3 NULL system NULL NULL NULL NULL 0 Const row not found # should not crash the next statement SELECT 1 FROM t1 WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3)) @@ -54,10 +54,10 @@ EXPLAIN SELECT (SELECT 1 FROM t1,t2 WHERE t2.b > t3.b) FROM t3 WHERE 1 = 0 GROUP BY 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 DEPENDENT SUBQUERY t1 index NULL PRIMARY 4 NULL 2 Using index -2 DEPENDENT SUBQUERY t2 ALL b NULL NULL NULL 2 Range checked for each record (index map: 0x2) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DEPENDENT SUBQUERY t1 NULL index NULL PRIMARY 4 NULL 2 Using index +2 DEPENDENT SUBQUERY t2 NULL ALL b NULL NULL NULL 2 Range checked for each record (index map: 0x2) # should return 0 rows SELECT (SELECT 1 FROM t1,t2 WHERE t2.b > t3.b) @@ -92,13 +92,13 @@ DROP TABLE t1,t2; # file .\item_subselect.cc, line 836 # EXPLAIN SELECT 1 LIKE ( 1 IN ( SELECT 1 ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1249 Select 2 was reduced during optimization DESCRIBE SELECT 1 LIKE ( 1 IN ( SELECT 1 ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1249 Select 2 was reduced during optimization # None of the below should crash @@ -123,16 +123,16 @@ SET @old_optimizer_switch = @@session.optimizer_switch; SET SESSION optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off'; EXPLAIN SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -x PRIMARY x x x x x x x x -x DEPENDENT SUBQUERY x x x x x x x x +id select_type table partitions type possible_keys key key_len ref rows Extra +x PRIMARY x x x x x x x x x +x DEPENDENT SUBQUERY x x x x x x x x x SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ); a b EXPLAIN SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL; a b 1 NULL @@ -153,30 +153,30 @@ SELECT * FROM t1 WHERE 1 = 1 AND ( a, b ) NOT IN ( SELECT c, d FROM t2 ); a b EXPLAIN SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 ); -id select_type table type possible_keys key key_len ref rows Extra -x PRIMARY x x x x x x x x -x DEPENDENT SUBQUERY x x x x x x x x +id select_type table partitions type possible_keys key key_len ref rows Extra +x PRIMARY x x x x x x x x x +x DEPENDENT SUBQUERY x x x x x x x x x SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 ); a b EXPLAIN SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -x PRIMARY x x x x x x x x -x DEPENDENT SUBQUERY x x x x x x x x +id select_type table partitions type possible_keys key key_len ref rows Extra +x PRIMARY x x x x x x x x x +x DEPENDENT SUBQUERY x x x x x x x x x SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 ); c d EXPLAIN SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -x PRIMARY x x x x x x x x -x DEPENDENT SUBQUERY x x x x x x x x +id select_type table partitions type possible_keys key key_len ref rows Extra +x PRIMARY x x x x x x x x x +x DEPENDENT SUBQUERY x x x x x x x x x SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 ); e f EXPLAIN SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 ); -id select_type table type possible_keys key key_len ref rows Extra -x PRIMARY x x x x x x x x -x DEPENDENT SUBQUERY x x x x x x x x +id select_type table partitions type possible_keys key key_len ref rows Extra +x PRIMARY x x x x x x x x x +x DEPENDENT SUBQUERY x x x x x x x x x SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 ); c d SELECT * FROM t1 WHERE ( a, b ) NOT IN @@ -223,9 +223,9 @@ CREATE TABLE t2d (pk INT NOT NULL, i INT NOT NULL, PRIMARY KEY(i)); INSERT INTO t2d VALUES (0,0), (1,1), (2,2), (3,3); EXPLAIN SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2a unique_subquery PRIMARY PRIMARY 8 const,test.t1.pk 1 Using index; Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2a NULL unique_subquery PRIMARY PRIMARY 8 const,test.t1.pk 1 Using index; Using where; Full scan on NULL key SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk); pk i SELECT * FROM t1 WHERE 1+NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk); @@ -244,9 +244,9 @@ pk NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk) 3 NULL EXPLAIN SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2b ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2b NULL ALL NULL NULL NULL NULL 4 Using where SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk); pk i SELECT * FROM t1 WHERE NULL IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk) IS UNKNOWN; @@ -263,9 +263,9 @@ pk NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk) 3 NULL EXPLAIN SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2c index_subquery it2c it2c 8 const,test.t1.pk 2 Using index; Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2c NULL index_subquery it2c it2c 8 const,test.t1.pk 2 Using index; Using where; Full scan on NULL key SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk); pk i SELECT * FROM t1 WHERE NULL IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk) IS UNKNOWN; @@ -282,9 +282,9 @@ pk NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk) 3 NULL EXPLAIN SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2d const PRIMARY PRIMARY 4 const 1 Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2d NULL const PRIMARY PRIMARY 4 const 1 Using where; Full scan on NULL key SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk); pk i SELECT * FROM t1 WHERE NULL IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk) IS UNKNOWN; @@ -301,9 +301,9 @@ pk NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk) 3 NULL EXPLAIN SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2a unique_subquery PRIMARY PRIMARY 8 const,test.t1.pk 1 Using index; Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2a NULL unique_subquery PRIMARY PRIMARY 8 const,test.t1.pk 1 Using index; Using where; Full scan on NULL key SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk); pk i 0 10 @@ -317,9 +317,9 @@ NULL 1 EXPLAIN SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2b ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2b NULL ALL NULL NULL NULL NULL 4 Using where SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk); pk i 0 10 @@ -333,9 +333,9 @@ NULL 1 EXPLAIN SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2c index_subquery it2c it2c 8 const,test.t1.pk 2 Using index; Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2c NULL index_subquery it2c it2c 8 const,test.t1.pk 2 Using index; Using where; Full scan on NULL key SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk); pk i 0 10 @@ -349,9 +349,9 @@ NULL 1 EXPLAIN SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2d const PRIMARY PRIMARY 4 const 1 Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2d NULL const PRIMARY PRIMARY 4 const 1 Using where; Full scan on NULL key SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk); pk i 0 10 @@ -383,9 +383,9 @@ SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 ; RESULT NULL EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 ; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select (/* select#2 */ select 1 from `test`.`t2` where 0) AS `RESULT` from dual @@ -394,9 +394,9 @@ SELECT (SELECT 1 FROM t2 WHERE d = IFNULL(c,NULL)) AS RESULT FROM t1 GROUP BY c RESULT NULL EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = IFNULL(c,NULL)) AS RESULT FROM t1 GROUP BY c; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select (/* select#2 */ select 1 from `test`.`t2` where 0) AS `RESULT` from dual group by NULL @@ -405,9 +405,9 @@ SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 GROUP BY c ; RESULT NULL EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 GROUP BY c ; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select (/* select#2 */ select 1 from `test`.`t2` where 0) AS `RESULT` from dual group by NULL @@ -493,11 +493,11 @@ WHERE PNUM IN (SELECT PNUM FROM t2 WHERE PTYPE = 'Design')); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL t1_IDX NULL NULL NULL 5 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 3 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 Using where -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL t1_IDX NULL NULL NULL 5 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) PREPARE stmt FROM "EXPLAIN SELECT EMPNAME FROM t1 WHERE EMPNUM IN @@ -508,17 +508,17 @@ WHERE EMPNUM IN FROM t2 WHERE PTYPE = 'Design'))"; EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL t1_IDX NULL NULL NULL 5 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 3 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 Using where -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL t1_IDX NULL NULL NULL 5 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL t1_IDX NULL NULL NULL 5 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 3 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 Using where -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL t1_IDX NULL NULL NULL 5 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) DEALLOCATE PREPARE stmt; DROP INDEX t1_IDX ON t1; CREATE INDEX t1_IDX ON t1(EMPNUM); @@ -531,11 +531,11 @@ WHERE PNUM IN (SELECT PNUM FROM t2 WHERE PTYPE = 'Design')); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL t1_IDX NULL NULL NULL 5 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 3 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 Using where -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL t1_IDX NULL NULL NULL 5 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) PREPARE stmt FROM "EXPLAIN SELECT EMPNAME FROM t1 WHERE EMPNUM IN @@ -546,17 +546,17 @@ WHERE EMPNUM IN FROM t2 WHERE PTYPE = 'Design'))"; EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL t1_IDX NULL NULL NULL 5 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 3 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 Using where -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL t1_IDX NULL NULL NULL 5 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL t1_IDX NULL NULL NULL 5 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 3 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 Using where -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL t1_IDX NULL NULL NULL 5 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) DEALLOCATE PREPARE stmt; DROP INDEX t1_IDX ON t1; EXPLAIN SELECT EMPNAME @@ -568,11 +568,11 @@ WHERE PNUM IN (SELECT PNUM FROM t2 WHERE PTYPE = 'Design')); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 3 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 Using where -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) PREPARE stmt FROM "EXPLAIN SELECT EMPNAME FROM t1 WHERE EMPNUM IN @@ -583,17 +583,17 @@ WHERE EMPNUM IN FROM t2 WHERE PTYPE = 'Design'))"; EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 3 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 Using where -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 3 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 Using where -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) DEALLOCATE PREPARE stmt; SET SESSION optimizer_switch = @old_optimizer_switch; SET SESSION join_cache_level = @old_join_cache_level; @@ -674,10 +674,10 @@ explain select a, (select sum(X.a+B.b) from t1 X, t2 B where B.a=A.a or B.b=A.a) from t1 A; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 10 -2 DEPENDENT SUBQUERY X ALL NULL NULL NULL NULL 10 -2 DEPENDENT SUBQUERY B ALL a,b NULL NULL NULL 1000 Range checked for each record (index map: 0x3) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 +2 DEPENDENT SUBQUERY X NULL ALL NULL NULL NULL NULL 10 +2 DEPENDENT SUBQUERY B NULL ALL a,b NULL NULL NULL 1000 Range checked for each record (index map: 0x3) drop table t1, t2; # # BUG#723822: Crash in get_constant_key_infix with EXISTS ( SELECT .. DISTINCT ) @@ -711,11 +711,11 @@ SELECT * FROM t1 WHERE f3 = ( SELECT t1.f3 FROM t1 WHERE ( t1.f10 ) IN ( SELECT f11 FROM t2 GROUP BY f11 )); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE f3 = ( SELECT t1.f3 FROM t1 @@ -726,11 +726,11 @@ SELECT * FROM t1 WHERE f3 = ( SELECT f3 FROM t1 WHERE ( f10, f10 ) IN ( SELECT f11, f11 FROM t2 GROUP BY f11 )); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 8 func,func 1 -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 8 func,func 1 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE f3 = ( SELECT f3 FROM t1 @@ -742,10 +742,10 @@ SELECT * FROM t1 WHERE f3 = ( SELECT t1.f3 FROM t1 WHERE ( t1.f10 ) IN ( SELECT max(f11) FROM t2 GROUP BY f11 )); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref f3 f3 5 const 0 Using where -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref f3 f3 5 const 0 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using temporary SELECT * FROM t1 WHERE f3 = ( SELECT t1.f3 FROM t1 @@ -756,10 +756,10 @@ SELECT * FROM t1 WHERE f3 = ( SELECT f3 FROM t1 WHERE ( f10, f10 ) IN ( SELECT max(f11), f11 FROM t2 GROUP BY f11 )); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref f3 f3 5 const 0 Using where -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref f3 f3 5 const 0 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using temporary SELECT * FROM t1 WHERE f3 = ( SELECT f3 FROM t1 @@ -776,183 +776,183 @@ set @save_optimizer_switch=@@optimizer_switch; SET @@optimizer_switch = 'materialization=on,in_to_exists=off,semijoin=off'; EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2); f1 f2 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in; not_in NULL EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2); f1 f2 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in; not_in NULL EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in; not_in 1 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in; not_in NULL EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in; not_in NULL EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in; not_in NULL EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No matching min/max row SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2); f1 f2 SET @@optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off'; EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2); f1 f2 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in; not_in NULL EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2); f1 f2 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in; not_in NULL EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in; not_in 1 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in; not_in NULL EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in; not_in NULL EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in; not_in NULL EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No matching min/max row SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2); f1 f2 INSERT INTO t1 VALUES (1, 2); @@ -962,183 +962,183 @@ INSERT INTO t2 VALUES (7, 8); SET @@optimizer_switch = 'materialization=on,in_to_exists=off,semijoin=off'; EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in; not_in NULL EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in; not_in NULL EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in; not_in 1 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in; not_in NULL EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in; not_in NULL EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in; not_in NULL EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No matching min/max row SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10); f1 f2 SET @@optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off'; EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in; not_in NULL EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in; not_in NULL EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in; not_in 1 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in; not_in NULL EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in; not_in NULL EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in; not_in NULL EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No matching min/max row SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10); f1 f2 set @@optimizer_switch=@save_optimizer_switch; @@ -1169,10 +1169,10 @@ EXPLAIN SELECT t1.f3, MAX(t1.f2) FROM t1, t2 WHERE (t2.pk = t1.pk) AND t2.pk IN (SELECT f2 FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system PRIMARY NULL NULL NULL 1 -1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 -2 DEPENDENT SUBQUERY t1 index_subquery f2 f2 4 func 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system PRIMARY NULL NULL NULL 1 +1 PRIMARY t1 NULL const PRIMARY PRIMARY 4 const 1 +2 DEPENDENT SUBQUERY t1 NULL index_subquery f2 f2 4 func 2 Using index SELECT t1.f3, MAX(t1.f2) FROM t1, t2 WHERE (t2.pk = t1.pk) AND t2.pk IN (SELECT f2 FROM t1); @@ -1183,10 +1183,10 @@ EXPLAIN SELECT t1.f3, MAX(t1.f2) FROM t1, t2 WHERE (t2.pk = t1.pk) AND t2.pk IN (SELECT f2 FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system PRIMARY NULL NULL NULL 1 -1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 -2 MATERIALIZED t1 index NULL f2 4 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system PRIMARY NULL NULL NULL 1 +1 PRIMARY t1 NULL const PRIMARY PRIMARY 4 const 1 +2 MATERIALIZED t1 NULL index NULL f2 4 NULL 2 Using index SELECT t1.f3, MAX(t1.f2) FROM t1, t2 WHERE (t2.pk = t1.pk) AND t2.pk IN (SELECT f2 FROM t1); @@ -1207,9 +1207,9 @@ set @save_optimizer_switch=@@optimizer_switch; set @@optimizer_switch='materialization=off,in_to_exists=on,subquery_cache=off'; EXPLAIN SELECT t1.f1, ( SELECT MAX( f2 ) FROM t2 WHERE t2.f3 = t1.f1 ) as max_f2 FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 SELECT t1.f1, ( SELECT MAX( f2 ) FROM t2 WHERE t2.f3 = t1.f1 ) as max_f2 FROM t1; f1 max_f2 b NULL @@ -1219,9 +1219,9 @@ x 1 set @@optimizer_switch='materialization=on,in_to_exists=off,subquery_cache=off'; EXPLAIN SELECT t1.f1, ( SELECT MAX( f2 ) FROM t2 WHERE t2.f3 = t1.f1 ) as max_f2 FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 SELECT t1.f1, ( SELECT MAX( f2 ) FROM t2 WHERE t2.f3 = t1.f1 ) as max_f2 FROM t1; f1 max_f2 b NULL @@ -1233,9 +1233,9 @@ Even when t2 is not constant table, the result must be the same. INSERT INTO t2 VALUES (2,'y'); EXPLAIN SELECT t1.f1, ( SELECT MAX( f2 ) FROM t2 WHERE t2.f3 = t1.f1 ) as max_f2 FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t1.f1, ( SELECT MAX( f2 ) FROM t2 WHERE t2.f3 = t1.f1 ) as max_f2 FROM t1; f1 max_f2 b NULL @@ -1260,38 +1260,38 @@ SET optimizer_switch='semijoin_with_cache=off'; SET optimizer_switch='materialization=off'; EXPLAIN SELECT * FROM t1 RIGHT JOIN t2 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT * FROM t1 RIGHT JOIN t2 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2); c1 c1 EXPLAIN SELECT * FROM t2 LEFT JOIN t1 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT * FROM t2 LEFT JOIN t1 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2); c1 c1 SET optimizer_switch='materialization=on'; EXPLAIN SELECT * FROM (t2 LEFT JOIN t1 ON t1.c1) LEFT JOIN t3 on t3.c1 WHERE 's' IN (SELECT c1 FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM (t2 LEFT JOIN t1 ON t1.c1) LEFT JOIN t3 on t3.c1 WHERE 's' IN (SELECT c1 FROM t2); c1 c1 c1 EXPLAIN SELECT * FROM t4 LEFT JOIN t2 ON t4.c1 WHERE 's' IN (SELECT c1 FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t4 index NULL PRIMARY 3 NULL 2 Using index; Using join buffer (flat, BNL join) -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t4 NULL index NULL PRIMARY 3 NULL 2 Using index; Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t4 LEFT JOIN t2 ON t4.c1 WHERE 's' IN (SELECT c1 FROM t2); c1 c1 SET optimizer_switch=@save_optimizer_switch; @@ -1310,10 +1310,10 @@ set @@optimizer_switch='in_to_exists=on,materialization=off,semijoin=off'; EXPLAIN SELECT * FROM t2 WHERE f1 IN (SELECT t1.f2 FROM t1 JOIN t3 ON t3.f4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) drop table t1, t2, t3; # # LP BUG#680005 Second assertion `cache != __null' failed in @@ -1340,12 +1340,12 @@ JOIN t1 AS SUBQUERY2_t3 ON SUBQUERY2_t3.f1) ON SUBQUERY2_t3.f2) GROUP BY t1.f4 ORDER BY t1.f1 LIMIT 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 Using temporary; Using filesort -1 PRIMARY t1 ALL NULL NULL NULL NULL 11 Using where -2 DEPENDENT SUBQUERY SUBQUERY2_t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY SUBQUERY2_t2 index NULL f4 5 NULL 11 Using index -2 DEPENDENT SUBQUERY SUBQUERY2_t3 ALL NULL NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 Using temporary; Using filesort +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 11 Using where +2 DEPENDENT SUBQUERY SUBQUERY2_t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY SUBQUERY2_t2 NULL index NULL f4 5 NULL 11 Using index +2 DEPENDENT SUBQUERY SUBQUERY2_t3 NULL ALL NULL NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) drop table t1, t2, t3; # # LP BUG#680038 bool close_thread_table(THD*, TABLE**): @@ -1367,11 +1367,11 @@ WHERE f4 <= ALL (SELECT max(SQ1_t1.f4) FROM t3 AS SQ1_t1 JOIN t3 AS SQ1_t3 ON SQ1_t3.f4 GROUP BY SQ1_t1.f4)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where -3 SUBQUERY SQ1_t3 range f4 f4 5 NULL 2 Using where; Using index; Using temporary -3 SUBQUERY SQ1_t1 index NULL f4 5 NULL 2 Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where +3 SUBQUERY SQ1_t3 NULL range f4 f4 5 NULL 2 Using where; Using index; Using temporary +3 SUBQUERY SQ1_t1 NULL index NULL f4 5 NULL 2 Using index; Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE (SELECT f2 FROM t2 WHERE f4 <= ALL @@ -1390,9 +1390,9 @@ CREATE TABLE t2 (i INTEGER, KEY k(i)); INSERT INTO t2 VALUES (1), (2); EXPLAIN SELECT i FROM t1 WHERE (1) NOT IN (SELECT i FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 SUBQUERY t2 index_subquery k k 5 const 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 SUBQUERY t2 NULL index_subquery k k 5 const 2 Using index DROP TABLE t2; DROP TABLE t1; # @@ -1408,10 +1408,10 @@ SELECT COUNT(t2.f3), FROM t2 JOIN t1 ON t1.f3 WHERE ('v') IN (SELECT f4 FROM t2) GROUP BY f9; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(t2.f3), (SELECT COUNT(f3) FROM t1 WHERE t2.f1) AS f9 FROM t2 JOIN t1 ON t1.f3 @@ -1424,10 +1424,10 @@ SELECT COUNT(t2.f3), FROM t2 JOIN t1 ON t1.f3 WHERE ('v') IN (SELECT f4 FROM t2) ORDER BY f9; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(t2.f3), (SELECT COUNT(f3) FROM t1 WHERE t2.f1) AS f9 FROM t2 JOIN t1 ON t1.f3 @@ -1441,10 +1441,10 @@ SELECT COUNT(t2.f3), FROM t2 JOIN t1 WHERE ('v') IN (SELECT f4 FROM t2) GROUP BY f9; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(t2.f3), (SELECT t2.f1 FROM t1 limit 1) AS f9 FROM t2 JOIN t1 @@ -1457,10 +1457,10 @@ SELECT COUNT(t2.f3), FROM t2 JOIN t1 WHERE ('v') IN (SELECT f4 FROM t2) ORDER BY f9; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(t2.f3), (SELECT t2.f1 FROM t1 limit 1) AS f9 FROM t2 JOIN t1 @@ -1478,17 +1478,17 @@ INSERT INTO t2 VALUES (1),(2); CREATE TABLE t1 (f1 int) ; EXPLAIN SELECT (SELECT f1 FROM t1) AS field1 FROM t2 GROUP BY field1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (SELECT f1 FROM t1) AS field1 FROM t2 GROUP BY field1; field1 NULL EXPLAIN SELECT (SELECT f1 FROM t1) AS field1 FROM t2 ORDER BY field1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (SELECT f1 FROM t1) AS field1 FROM t2 ORDER BY field1; field1 NULL @@ -1496,16 +1496,16 @@ NULL INSERT INTO t1 VALUES (1),(2); EXPLAIN SELECT (SELECT f1 FROM t1) AS field1 FROM t2 GROUP BY field1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT (SELECT f1 FROM t1) AS field1 FROM t2 GROUP BY field1; ERROR 21000: Subquery returns more than 1 row EXPLAIN SELECT (SELECT f1 FROM t1) AS field1 FROM t2 ORDER BY field1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT (SELECT f1 FROM t1) AS field1 FROM t2 ORDER BY field1; ERROR 21000: Subquery returns more than 1 row drop table t1,t2; @@ -1540,106 +1540,106 @@ set @save_optimizer_switch=@@optimizer_switch; SET @@optimizer_switch = 'in_to_exists=off,semijoin=off,materialization=on'; EXPLAIN SELECT 'bug' FROM DUAL WHERE ( 5 ) IN ( SELECT * FROM v1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where -3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 2 Using where +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL SELECT 'bug' FROM DUAL WHERE ( 5 ) IN ( SELECT * FROM v1 ); bug EXPLAIN SELECT ( 5 ) IN ( SELECT * FROM v1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where -3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 2 Using where +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL SELECT ( 5 ) IN ( SELECT * FROM v1 ); ( 5 ) IN ( SELECT * FROM v1 ) 0 EXPLAIN SELECT 'bug' FROM DUAL WHERE ( 5 ) IN (SELECT * FROM v2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where -3 DERIVED t1 system NULL NULL NULL NULL 1 -4 UNION t2 system NULL NULL NULL NULL 1 -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 2 Using where +3 DERIVED t1 NULL system NULL NULL NULL NULL 1 +4 UNION t2 NULL system NULL NULL NULL NULL 1 +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL SELECT 'bug' FROM DUAL WHERE ( 5 ) IN (SELECT * FROM v2); bug EXPLAIN SELECT 'bug' FROM t3 WHERE ( 5 ) IN (SELECT * FROM v2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 system NULL NULL NULL NULL 1 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 2 -3 DERIVED t1 system NULL NULL NULL NULL 1 -4 UNION t2 system NULL NULL NULL NULL 1 -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 2 +3 DERIVED t1 NULL system NULL NULL NULL NULL 1 +4 UNION t2 NULL system NULL NULL NULL NULL 1 +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL SELECT 'bug' FROM t3 WHERE ( 5 ) IN (SELECT * FROM v2); bug EXPLAIN SELECT ( 5 ) IN ( SELECT * FROM v2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where -3 DERIVED t1 system NULL NULL NULL NULL 1 -4 UNION t2 system NULL NULL NULL NULL 1 -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 2 Using where +3 DERIVED t1 NULL system NULL NULL NULL NULL 1 +4 UNION t2 NULL system NULL NULL NULL NULL 1 +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL SELECT ( 5 ) IN ( SELECT * FROM v2 ); ( 5 ) IN ( SELECT * FROM v2 ) 0 SET @@optimizer_switch = 'in_to_exists=on,semijoin=off,materialization=off'; EXPLAIN SELECT 'bug' FROM DUAL WHERE ( 5 ) IN ( SELECT * FROM v1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where -3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 2 Using where +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL SELECT 'bug' FROM DUAL WHERE ( 5 ) IN ( SELECT * FROM v1 ); bug EXPLAIN SELECT ( 5 ) IN ( SELECT * FROM v1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where -3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 2 Using where +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL SELECT ( 5 ) IN ( SELECT * FROM v1 ); ( 5 ) IN ( SELECT * FROM v1 ) 0 EXPLAIN SELECT 'bug' FROM DUAL WHERE ( 5 ) IN (SELECT * FROM v2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where -3 DERIVED t1 system NULL NULL NULL NULL 1 -4 UNION t2 system NULL NULL NULL NULL 1 -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 2 Using where +3 DERIVED t1 NULL system NULL NULL NULL NULL 1 +4 UNION t2 NULL system NULL NULL NULL NULL 1 +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL SELECT 'bug' FROM DUAL WHERE ( 5 ) IN (SELECT * FROM v2); bug EXPLAIN SELECT 'bug' FROM t3 WHERE ( 5 ) IN (SELECT * FROM v2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 system NULL NULL NULL NULL 1 -2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where -3 DERIVED t1 system NULL NULL NULL NULL 1 -4 UNION t2 system NULL NULL NULL NULL 1 -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 +2 SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 2 Using where +3 DERIVED t1 NULL system NULL NULL NULL NULL 1 +4 UNION t2 NULL system NULL NULL NULL NULL 1 +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL SELECT 'bug' FROM t3 WHERE ( 5 ) IN (SELECT * FROM v2); bug EXPLAIN SELECT ( 5 ) IN ( SELECT * FROM v2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 Using where -3 DERIVED t1 system NULL NULL NULL NULL 1 -4 UNION t2 system NULL NULL NULL NULL 1 -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 2 Using where +3 DERIVED t1 NULL system NULL NULL NULL NULL 1 +4 UNION t2 NULL system NULL NULL NULL NULL 1 +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL SELECT ( 5 ) IN ( SELECT * FROM v2 ); ( 5 ) IN ( SELECT * FROM v2 ) 0 @@ -1666,10 +1666,10 @@ SELECT alias2.f1 , alias2.f2 FROM t0 AS alias1 RIGHT JOIN t0 AS alias2 ON alias2.f10 WHERE ( alias2.f1 , alias2.f2 ) IN ( SELECT max(f2) , f1 FROM t0 GROUP BY f2 , f1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY alias1 index NULL PRIMARY 4 NULL 2 Using where; Using index -2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 2 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY alias1 NULL index NULL PRIMARY 4 NULL 2 Using where; Using index +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 2 Using temporary SELECT alias2.f1 , alias2.f2 FROM t0 AS alias1 RIGHT JOIN t0 AS alias2 ON alias2.f10 @@ -1680,17 +1680,17 @@ Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'u' EXPLAIN SELECT * FROM t2 WHERE (f1b, f2b) IN (SELECT max(f1a), f2a FROM t1 GROUP BY f1a, f2a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary SELECT * FROM t2 WHERE (f1b, f2b) IN (SELECT max(f1a), f2a FROM t1 GROUP BY f1a, f2a); f1b f2b f3b 10 5 d1d EXPLAIN SELECT * FROM t2 WHERE (f1b) IN (SELECT max(f1a) FROM t1 GROUP BY f1a, f2a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary SELECT * FROM t2 WHERE (f1b) IN (SELECT max(f1a) FROM t1 GROUP BY f1a, f2a); f1b f2b f3b 10 5 d1d @@ -1700,10 +1700,10 @@ SELECT alias2.f1 , alias2.f2 FROM t0 AS alias1 RIGHT JOIN t0 AS alias2 ON alias2.f10 WHERE ( alias2.f1 , alias2.f2 ) IN ( SELECT max(f2) , f1 FROM t0 GROUP BY f2 , f1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY alias1 index NULL PRIMARY 4 NULL 2 Using where; Using index -2 MATERIALIZED t0 ALL NULL NULL NULL NULL 2 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY alias1 NULL index NULL PRIMARY 4 NULL 2 Using where; Using index +2 MATERIALIZED t0 NULL ALL NULL NULL NULL NULL 2 Using temporary SELECT alias2.f1 , alias2.f2 FROM t0 AS alias1 RIGHT JOIN t0 AS alias2 ON alias2.f10 @@ -1714,17 +1714,17 @@ Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'u' EXPLAIN SELECT * FROM t2 WHERE (f1b, f2b) IN (SELECT max(f1a), f2a FROM t1 GROUP BY f1a, f2a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 Using temporary SELECT * FROM t2 WHERE (f1b, f2b) IN (SELECT max(f1a), f2a FROM t1 GROUP BY f1a, f2a); f1b f2b f3b 10 5 d1d EXPLAIN SELECT * FROM t2 WHERE (f1b) IN (SELECT max(f1a) FROM t1 GROUP BY f1a, f2a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 Using temporary SELECT * FROM t2 WHERE (f1b) IN (SELECT max(f1a) FROM t1 GROUP BY f1a, f2a); f1b f2b f3b 10 5 d1d @@ -1741,9 +1741,9 @@ CREATE TABLE t2 (b1 int, b2 int) ; INSERT INTO t2 VALUES (1, 2); SET @@optimizer_switch = 'in_to_exists=on,materialization=off,semijoin=off'; EXPLAIN SELECT * FROM t1 WHERE a1 IN (SELECT b1 FROM t2 WHERE b1 = b2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 WHERE a1 IN (SELECT b1 FROM t2 WHERE b1 = b2); a1 a2 set @@optimizer_switch=@save_optimizer_switch; @@ -1760,11 +1760,11 @@ INSERT INTO t3 VALUES (0,0), (0,0); EXPLAIN SELECT STRAIGHT_JOIN ( SELECT f2 FROM t1 WHERE ( f2 ) IN ( SELECT t3.f2 FROM t3 JOIN t2 ON t2.f1 = 1 ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) SELECT STRAIGHT_JOIN ( SELECT f2 FROM t1 WHERE ( f2 ) IN ( SELECT t3.f2 FROM t3 JOIN t2 ON t2.f1 = 1 ) ); @@ -1785,10 +1785,10 @@ INSERT IGNORE INTO t3 VALUES (1); SET SESSION optimizer_switch='in_to_exists=on,materialization=off'; EXPLAIN SELECT * FROM t1 WHERE ( 6 ) NOT IN ( SELECT t2.f3 FROM t2 JOIN t3 ON t3.f10 = t2.f10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t3 system NULL NULL NULL NULL 1 -2 SUBQUERY t2 ref_or_null f10 f10 10 const,const 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t3 NULL system NULL NULL NULL NULL 1 +2 SUBQUERY t2 NULL ref_or_null f10 f10 10 const,const 2 Using where; Using index SELECT * FROM t1 WHERE ( 6 ) NOT IN ( SELECT t2.f3 FROM t2 JOIN t3 ON t3.f10 = t2.f10); f4 drop table t1,t2,t3; @@ -1807,10 +1807,10 @@ SELECT MAX( f3 ) FROM t3 WHERE EXISTS ( SELECT DISTINCT f11 FROM t1)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 -3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 drop table t1, t2, t3; # # LP BUG#802979 Assertion `table->key_read == 0' in close_thread_table @@ -1829,11 +1829,11 @@ FROM t1, t2 WHERE t2.f2 = (SELECT f2 FROM t3 WHERE EXISTS (SELECT DISTINCT f1 FROM t4)) AND t2.f2 = t1.f1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref f1 f1 5 const 0 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 -3 SUBQUERY t4 index NULL f1 5 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref f1 f1 5 const 0 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 +3 SUBQUERY t4 NULL index NULL f1 5 NULL 2 Using index SELECT * FROM t1, t2 WHERE t2.f2 = (SELECT f2 FROM t3 @@ -1846,11 +1846,11 @@ FROM t1, t2 WHERE t2.f2 = (SELECT f2 FROM t3 WHERE EXISTS (SELECT DISTINCT f1 FROM t4) LIMIT 1) AND t2.f2 = t1.f1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref f1 f1 5 const 0 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 -3 SUBQUERY t4 index NULL f1 5 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref f1 f1 5 const 0 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 +3 SUBQUERY t4 NULL index NULL f1 5 NULL 2 Using index SELECT * FROM t1, t2 WHERE t2.f2 = (SELECT f2 FROM t3 @@ -1889,11 +1889,11 @@ FROM t1 SUBQUERY2_t1 STRAIGHT_JOIN t1 SUBQUERY2_t2 ON SUBQUERY2_t2.col_varchar_key WHERE SUBQUERY2_t2.col_varchar_nokey IN (SELECT col_varchar_nokey FROM t1 GROUP BY col_varchar_nokey)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index NULL col_int_key 5 NULL 2 Using index -2 SUBQUERY SUBQUERY2_t1 index NULL col_int_key 5 NULL 2 Using index -2 SUBQUERY SUBQUERY2_t2 ALL col_varchar_key NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index NULL col_int_key 5 NULL 2 Using index +2 SUBQUERY SUBQUERY2_t1 NULL index NULL col_int_key 5 NULL 2 Using index +2 SUBQUERY SUBQUERY2_t2 NULL ALL col_varchar_key NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 SELECT col_int_key FROM t2 WHERE (SELECT SUBQUERY2_t1.col_int_key @@ -1914,11 +1914,11 @@ FROM t1 SUBQUERY2_t1 STRAIGHT_JOIN t1 SUBQUERY2_t2 ON SUBQUERY2_t2.col_varchar_key WHERE SUBQUERY2_t2.col_varchar_nokey IN (SELECT col_varchar_nokey FROM t1 GROUP BY col_varchar_nokey)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index NULL col_int_key 5 NULL 2 Using index -2 SUBQUERY SUBQUERY2_t1 index NULL col_int_key 5 NULL 2 Using index -2 SUBQUERY SUBQUERY2_t2 ALL col_varchar_key NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index NULL col_int_key 5 NULL 2 Using index +2 SUBQUERY SUBQUERY2_t1 NULL index NULL col_int_key 5 NULL 2 Using index +2 SUBQUERY SUBQUERY2_t2 NULL ALL col_varchar_key NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT col_int_key FROM t2 WHERE (SELECT SUBQUERY2_t1.col_int_key @@ -1943,10 +1943,10 @@ CREATE VIEW v2 AS SELECT * FROM t2; set @old_optimizer_switch = @@optimizer_switch; set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off,subquery_cache=off'; EXPLAIN SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 PREPARE st1 FROM "SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 )"; EXECUTE st1; f1 f2 f3 @@ -1958,10 +1958,10 @@ f1 f2 f3 5 y x set @@optimizer_switch='materialization=off,in_to_exists=on,semijoin=off,subquery_cache=off'; EXPLAIN SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where PREPARE st2 FROM "SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 )"; EXECUTE st2; f1 f2 f3 @@ -1973,10 +1973,10 @@ f1 f2 f3 5 y x set @@optimizer_switch='materialization=on,in_to_exists=on,semijoin=off,subquery_cache=off'; EXPLAIN SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 PREPARE st3 FROM "SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 )"; EXECUTE st3; f1 f2 f3 @@ -2004,11 +2004,11 @@ SELECT t2.f1, (SELECT f2 FROM t1 WHERE (7) IN (SELECT f1 FROM t1)) FROM t2 JOIN t3 ON t3.f4 = t2.f4 WHERE t3.f1 = 8 GROUP BY 1, 2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using filesort -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using filesort +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table PREPARE st1 FROM " SELECT t2.f1, (SELECT f2 FROM t1 WHERE (7) IN (SELECT f1 FROM t1)) FROM t2 JOIN t3 ON t3.f4 = t2.f4 @@ -2036,11 +2036,11 @@ set @@optimizer_switch = 'materialization=on,in_to_exists=off,semijoin=off'; EXPLAIN SELECT t1.f4 FROM t1 JOIN ( t2 JOIN t3 ON t3.f3 = t2.f4 ) ON t3.f3 = t2.f3 WHERE t1.f4 IN ( SELECT f4 FROM t2 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t3 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT t1.f4 FROM t1 JOIN ( t2 JOIN t3 ON t3.f3 = t2.f4 ) ON t3.f3 = t2.f3 WHERE t1.f4 IN ( SELECT f4 FROM t2 ) ; @@ -2049,11 +2049,11 @@ set @@optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off'; EXPLAIN SELECT t1.f4 FROM t1 JOIN ( t2 JOIN t3 ON t3.f3 = t2.f4 ) ON t3.f3 = t2.f3 WHERE t1.f4 IN ( SELECT f4 FROM t2 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t3 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t1.f4 FROM t1 JOIN ( t2 JOIN t3 ON t3.f3 = t2.f4 ) ON t3.f3 = t2.f3 WHERE t1.f4 IN ( SELECT f4 FROM t2 ) ; @@ -2146,10 +2146,10 @@ c a b 10 7 0 EXPLAIN SELECT * FROM t2 WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.a < ANY (SELECT t4.a FROM t4) and t3.a = 7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where -3 SUBQUERY t4 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where +3 SUBQUERY t4 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t2 WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.a < ANY (SELECT t4.a FROM t4) and t3.a = 7); c a b @@ -2180,9 +2180,9 @@ create table five (a int, b int, c int); insert into five select a,a,a from ten limit 5; set @@optimizer_switch='semijoin=on,in_to_exists=on,materialization=off'; explain select * from t1 where 33 in (select b from five) or c > 11; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where -2 SUBQUERY five ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 Using where +2 SUBQUERY five NULL ALL NULL NULL NULL NULL 5 Using where drop table ten, t1, five; # # LP BUG#1008773 Wrong result (NULL instead of a value) with no matching rows, subquery in FROM and HAVING @@ -2192,49 +2192,49 @@ CREATE TABLE t2 (b INT) ENGINE=MyISAM; INSERT INTO t2 VALUES (1); EXPLAIN SELECT MAX(a), ( SELECT 1 FROM t2 ) AS bb FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY t2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 1 SELECT MAX(a), ( SELECT 1 FROM t2 ) AS bb FROM t1; MAX(a) bb NULL 1 EXPLAIN SELECT MAX(a), 1 in ( SELECT b FROM t2 ) AS bb FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY t2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 1 SELECT MAX(a), 1 in ( SELECT b FROM t2 ) AS bb FROM t1; MAX(a) bb NULL 1 EXPLAIN SELECT MAX(a), 1 >= ALL ( SELECT b FROM t2 ) AS bb FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT MAX(a), 1 >= ALL ( SELECT b FROM t2 ) AS bb FROM t1; MAX(a) bb NULL 1 EXPLAIN SELECT MAX(a), ( SELECT 1 FROM t2 where b = a) AS bb FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT MAX(a), ( SELECT 1 FROM t2 where b = a) AS bb FROM t1; MAX(a) bb NULL NULL EXPLAIN SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 SELECT MAX(a), a in ( SELECT b FROM t2 ) AS bb FROM t1; MAX(a) bb NULL NULL EXPLAIN SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 SELECT MAX(a), a >= ALL ( SELECT b FROM t2 ) AS bb FROM t1; MAX(a) bb NULL NULL @@ -2255,10 +2255,10 @@ SELECT a2 FROM t2 WHERE a2 IN ( SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3 ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE a1 IN ( SELECT a2 FROM t2 WHERE a2 IN ( SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3 @@ -2347,9 +2347,9 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE f NOT IN (SELECT b FROM t1 WHERE 0 OR (c IN ('USA') OR c NOT IN ('USA')) AND a = b); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 /* select#1 */ select 3 AS `f` from dual where !<expr_cache><3>(<in_optimizer>(3,<exists>(/* select#2 */ select `test`.`t1`.`b` from `test`.`t1` where (`test`.`t1`.`c` = 'USA' or `test`.`t1`.`c` <> 'USA') and trigcond(<cache>(3) = `test`.`t1`.`b` or `test`.`t1`.`b` is null) and `test`.`t1`.`b` = `test`.`t1`.`a` having trigcond(`test`.`t1`.`b` is null)))) SELECT * FROM t2 @@ -2396,9 +2396,9 @@ CREATE TABLE t1 (id int not null auto_increment, x int not null, primary key(id) INSERT INTO t1 (x) VALUES (0),(0),(0); EXPLAIN SELECT x FROM t1 WHERE id > (SELECT MAX(id) - 1000 FROM t1) ORDER BY x LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT x FROM t1 WHERE id > (SELECT MAX(id) - 1000 FROM t1) ORDER BY x LIMIT 1; x 0 @@ -2496,9 +2496,9 @@ drop table t1,t2; # explain SELECT 2 IN (SELECT 2 from DUAL WHERE 1 != 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT 2 IN (SELECT 2 from DUAL WHERE 1 != 1); 2 IN (SELECT 2 from DUAL WHERE 1 != 1) 0 @@ -2546,9 +2546,9 @@ CREATE TABLE t2(a INT, b INT); INSERT INTO t1 VALUES (1,1),(2,2),(3,3); INSERT INTO t2 VALUES (1,1),(2,2),(3,3); EXPLAIN EXTENDED SELECT sum(a), t2.a, t2.b FROM t2 HAVING t2.a IN (SELECT t2.b FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Zero limit -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Zero limit +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1276 Field or reference 'test.t2.b' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.b' of SELECT #2 was resolved in SELECT #1 @@ -2557,9 +2557,9 @@ SELECT sum(a), t2.a, t2.b FROM t2 HAVING t2.a IN (SELECT t2.b FROM t1); sum(a) a b SET @@sql_select_limit= @save_sql_select_limit; EXPLAIN EXTENDED SELECT sum(a), t2.a, t2.b FROM t2 HAVING t2.a IN (SELECT t2.b FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1276 Field or reference 'test.t2.b' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.b' of SELECT #2 was resolved in SELECT #1 @@ -2576,9 +2576,9 @@ INSERT INTO t1 VALUES ('e',2),('o',6),('x',4); CREATE TABLE t2 (v1 varchar(10) CHARACTER SET utf8, KEY v1 (v1(3))); INSERT INTO t2 VALUES ('k'),('rid'),('f'),('x'); EXPLAIN EXTENDED SELECT * FROM t1 where ( t1.l1 < ANY (SELECT MAX(t2.v1) FROM t2)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`l1` AS `l1`,`test`.`t1`.`i2` AS `i2` from `test`.`t1` where <nop>(<in_optimizer>(`test`.`t1`.`l1`,<max>(/* select#2 */ select max(`test`.`t2`.`v1`) from `test`.`t2`) > convert(<cache>(`test`.`t1`.`l1`) using utf8mb3))) SELECT * FROM t1 where ( t1.l1 < ANY (SELECT MAX(t2.v1) FROM t2)); @@ -2619,32 +2619,32 @@ CREATE TABLE t2 (a INT); INSERT INTO t2 VALUES (2),(3); EXPLAIN SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT UNION B ALL NULL NULL NULL NULL 2 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY A NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT UNION B NULL ALL NULL NULL NULL NULL 2 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1); a 1 2 EXPLAIN SELECT t1.a FROM t1 WHERE EXISTS (SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY A ALL NULL NULL NULL NULL 2 -3 UNION B ALL NULL NULL NULL NULL 2 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY A NULL ALL NULL NULL NULL NULL 2 +3 UNION B NULL ALL NULL NULL NULL NULL 2 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT t1.a FROM t1 WHERE EXISTS (SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1); a 1 2 EXPLAIN SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION ALL SELECT B.a FROM t2 B ORDER BY 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT UNION B ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY A NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT UNION B NULL ALL NULL NULL NULL NULL 2 Using where SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION ALL SELECT B.a FROM t2 B ORDER BY 1); a 1 @@ -2673,9 +2673,9 @@ CREATE TABLE t2 (f VARCHAR(2048) DEFAULT ''); INSERT INTO t2 VALUES ('1'),('bar'); EXPLAIN SELECT * FROM t2 WHERE f IN ( SELECT MAX(c) FROM t1 GROUP BY c WITH ROLLUP); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6000 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 6000 Using filesort SELECT * FROM t2 WHERE f IN ( SELECT MAX(c) FROM t1 GROUP BY c WITH ROLLUP); f 1 @@ -2704,10 +2704,10 @@ INSERT INTO t1 VALUES ('foo'),('bar'); CREATE TABLE t2 (b VARBINARY(8)); EXPLAIN SELECT a FROM t1 WHERE (a, a) IN (SELECT 'qux', 'qux') AND a = (SELECT MIN(b) FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used SELECT a FROM t1 WHERE (a, a) IN (SELECT 'qux', 'qux') AND a = (SELECT MIN(b) FROM t2); a DROP TABLE t1,t2; @@ -2716,10 +2716,10 @@ INSERT INTO t1 VALUES (1),(2); CREATE TABLE t2 (b VARBINARY(8)); EXPLAIN SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2); a DROP TABLE t1,t2; @@ -2779,8 +2779,8 @@ set names 'utf8mb4'; # EXPLAIN SELECT * FROM t1 WHERE (t1.a,t1.b) IN (('abx',1),('def',2), ('abc', 3)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where set names 'utf8'; # # IN predicate to IN subquery is performed as materialization is llowed @@ -2789,11 +2789,11 @@ set names 'utf8'; # this test in 10.5 has only 2 rows in the IN predicate EXPLAIN SELECT * FROM t2 WHERE (t2.a,t2.b) IN (('abc',1), ('def', 2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 5 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 func,func 1 Using where -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 2 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 16 func,func 1 Using where +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 2 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used set names default; set @@in_predicate_conversion_threshold= @save_in_predicate_conversion_threshold; DROP TABLE t1,t2; @@ -2883,39 +2883,39 @@ create table t2 as select * from t1; explain select * from t1 where exists (select * from t2 where t2.a=t1.a order by t2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 100 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 100 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 100 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 100 # query with a non-zero constant LIMIT is converted to semi-join, too: explain select * from t1 where exists (select * from t2 where t2.a=t1.a order by t2.b limit 2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 100 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 100 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 100 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 100 # Zero LIMIT should prevent the conversion (but it is not visible atm # due to MDEV-19429) explain select * from t1 where exists (select * from t2 where t2.a=t1.a order by t2.b limit 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 100 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Zero limit +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 100 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Zero limit # LIMIT+OFFSET prevents the conversion: explain select * from t1 where exists (select * from t2 where t2.a=t1.a order by t2.b limit 2,3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 100 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 100 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 100 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 100 Using where; Using filesort # This will be merged and converted into a semi-join: explain select * from t1 where t1.a in (select t2.a from t2 order by t2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 100 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 100 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 100 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 100 drop table t0, t1, t2; # End of 10.4 tests diff --git a/mysql-test/main/subselect4.test b/mysql-test/main/subselect4.test index 0a4fad953cb..748903a273d 100644 --- a/mysql-test/main/subselect4.test +++ b/mysql-test/main/subselect4.test @@ -135,7 +135,7 @@ INSERT INTO t5 VALUES (NULL), (2); SET @old_optimizer_switch = @@session.optimizer_switch; SET SESSION optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off'; ---replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x EXPLAIN SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ); SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ); @@ -149,22 +149,22 @@ SELECT * FROM t1 WHERE (( a, b ) NOT IN ( SELECT c, d FROM t2 )) IS UNKNOWN; SELECT * FROM t1 WHERE 1 = 1 AND ( a, b ) NOT IN ( SELECT c, d FROM t2 ); ---replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x EXPLAIN SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 ); SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 ); ---replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x EXPLAIN SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 ); SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 ); ---replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x EXPLAIN SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 ); SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 ); ---replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x +--replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x EXPLAIN SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 ); SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 ); diff --git a/mysql-test/main/subselect_cache.result b/mysql-test/main/subselect_cache.result index 132e870a860..c5864dee4ee 100644 --- a/mysql-test/main/subselect_cache.result +++ b/mysql-test/main/subselect_cache.result @@ -2091,9 +2091,9 @@ Handler_read_rnd_next 16 alter table t2 drop primary key; set optimizer_switch='default,semijoin=off,materialization=off,subquery_cache=off'; explain select * from t1 where a in (select pk from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 15 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 15 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 10 Using where flush status; select * from t1 where a in (select pk from t2); a b @@ -2129,9 +2129,9 @@ Handler_read_rnd_deleted 0 Handler_read_rnd_next 151 set optimizer_switch='default,semijoin=off,materialization=off,subquery_cache=on'; explain select * from t1 where a in (select pk from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 15 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 15 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 10 Using where flush status; select * from t1 where a in (select pk from t2); a b @@ -2167,9 +2167,9 @@ Handler_read_rnd_deleted 0 Handler_read_rnd_next 43 set optimizer_switch='default,semijoin=off,materialization=on,subquery_cache=on'; explain select * from t1 where a in (select pk from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 15 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 15 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 10 flush status; select * from t1 where a in (select pk from t2); a b @@ -3658,9 +3658,9 @@ insert into t2 values (1),(2); set optimizer_switch='default,semijoin=off,materialization=off,subquery_cache=on'; explain extended select * from t1 where a in (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t2`.`b` from `test`.`t2` where <cache>(`test`.`t1`.`a`) = `test`.`t2`.`b`))) drop table t1,t2; diff --git a/mysql-test/main/subselect_exists2in.result b/mysql-test/main/subselect_exists2in.result index 6ff518b5a29..d45cf944106 100644 --- a/mysql-test/main/subselect_exists2in.result +++ b/mysql-test/main/subselect_exists2in.result @@ -50,9 +50,9 @@ a c explain extended SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index aa aa 4 NULL 2 100.00 Using index -1 PRIMARY t3 ALL bb NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index aa aa 4 NULL 2 100.00 Using index +1 PRIMARY t3 NULL ALL bb NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t3`) where `test`.`t3`.`b` = `test`.`t1`.`a` @@ -63,9 +63,9 @@ a c explain extended SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL aa 4 NULL 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t3 ALL bb NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL aa 4 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL ALL bb NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t3`.`b` from `test`.`t3` where <cache>(`test`.`t1`.`a`) = `test`.`t3`.`b`)) @@ -76,9 +76,9 @@ a c explain extended SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL aa 4 NULL 2 100.00 Using where; Using index -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL aa 4 NULL 2 100.00 Using where; Using index +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t3`.`b` from `test`.`t3` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`b`))) @@ -89,9 +89,9 @@ a c explain extended SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL aa 4 NULL 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t3 ALL bb NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL aa 4 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL ALL bb NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`a` limit 1) @@ -239,10 +239,10 @@ where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.b) and t2.c > 'b1' ) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index -2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index -2 DEPENDENT SUBQUERY t3 index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 128 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 164 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2); Using join buffer (flat, BNL join) select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.b) and @@ -270,10 +270,10 @@ where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.c) and t2.c > 'b1' ) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index -2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index -2 DEPENDENT SUBQUERY t3 index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 128 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 164 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2); Using join buffer (flat, BNL join) select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.c) and @@ -311,9 +311,9 @@ explain extended SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t2 WHERE b = a ) OR a > 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`b` from `test`.`t2` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`b`)))) or `test`.`t1`.`a` > 0 @@ -327,10 +327,10 @@ INSERT INTO t3 VALUES (4),(5); SET optimizer_switch='exists_to_in=on,subquery_cache=off,materialization=on,in_to_exists=off,semijoin=off'; explain extended SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t2 system NULL NULL NULL NULL 1 100.00 -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 1 100.00 +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2 Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in (<primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` @@ -341,10 +341,10 @@ SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FR SET optimizer_switch='exists_to_in=on,subquery_cache=off'; explain extended SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t2 system NULL NULL NULL NULL 1 100.00 -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 1 100.00 +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2 Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in (<primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` @@ -355,10 +355,10 @@ SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FR SET optimizer_switch='exists_to_in=off,subquery_cache=off'; explain extended SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t2 system NULL NULL NULL NULL 1 100.00 -3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 1 100.00 +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2 Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !exists(/* select#3 */ select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` = 1 limit 1)) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` @@ -384,9 +384,9 @@ a a1 c c explain extended SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 index bb bb 8 NULL 2 100.00 Using where; Using index; LooseScan -1 PRIMARY t1 ref aa aa 8 test.t3.b,test.t3.b1 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL index bb bb 8 NULL 2 100.00 Using where; Using index; LooseScan +1 PRIMARY t1 NULL ref aa aa 8 test.t3.b,test.t3.b1 2 100.00 Using index Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1 @@ -398,9 +398,9 @@ a a1 c c explain extended SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL aa 8 NULL 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t3 index_subquery bb bb 8 func,func 2 100.00 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL aa 8 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index_subquery bb bb 8 func,func 2 100.00 Using index; Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1 @@ -412,9 +412,9 @@ a a1 c c explain extended SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL aa 8 NULL 2 100.00 Using where; Using index -2 MATERIALIZED t3 index NULL bb 8 NULL 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL aa 8 NULL 2 100.00 Using where; Using index +2 MATERIALIZED t3 NULL index NULL bb 8 NULL 2 100.00 Using index Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1 @@ -426,9 +426,9 @@ a a1 c c explain extended SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL aa 8 NULL 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t3 ref bb bb 8 test.t1.a,test.t1.a1 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL aa 8 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL ref bb bb 8 test.t1.a,test.t1.a1 2 100.00 Using index Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1 @@ -462,10 +462,10 @@ WHERE EXISTS ( SELECT * FROM t1, t2 WHERE a <= v.d AND b = v.b ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'v.d' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'v.b' of SELECT #2 was resolved in SELECT #1 @@ -539,11 +539,11 @@ WHERE EXISTS ( SELECT * FROM t1, t2 WHERE a <= alias2.a AND c = alias1.b ) OR alias1 .a = 'foo'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 4 100.00 -1 PRIMARY alias2 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 4 100.00 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.alias2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.alias1.b' of SELECT #2 was resolved in SELECT #1 @@ -566,9 +566,9 @@ a 8 explain extended SELECT * FROM t1 WHERE NOT EXISTS ( SELECT * FROM t2 WHERE b = a ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where !(`test`.`t1`.`a` is not null and <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t2`.`b` from `test`.`t2` where `test`.`t2`.`b` is not null and <cache>(`test`.`t1`.`a`) = `test`.`t2`.`b`)))) @@ -589,9 +589,9 @@ s v explain extended SELECT * FROM t1 AS alias WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY alias ALL NULL NULL NULL NULL 2 100.00 Using where -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(alias); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(alias); Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.alias.b' of SELECT #2 was resolved in SELECT #1 @@ -605,9 +605,9 @@ s v explain extended SELECT * FROM t1 AS alias WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY alias ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.alias.b' of SELECT #2 was resolved in SELECT #1 @@ -620,9 +620,9 @@ s v explain extended SELECT * FROM t1 AS alias WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY alias ALL NULL NULL NULL NULL 2 100.00 Using where -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; End temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; End temporary Warnings: Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.alias.b' of SELECT #2 was resolved in SELECT #1 @@ -657,10 +657,10 @@ SELECT * FROM t1 AS alias1, t2 AS alias2 WHERE EXISTS ( SELECT 1 FROM t2 WHERE b = alias1.a AND b > alias2.b ) OR a = 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.alias1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.alias2.b' of SELECT #2 was resolved in SELECT #1 @@ -717,10 +717,10 @@ insert into t1 values (1,2,3),(2,3,4),(4,5,6); create table t2 as select * from t1; explain extended select * from t1 where exists (select col2 from t2 where t2.col1=t1.col1 and t2.col2=t1.col2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1276 Field or reference 'test.t1.col1' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.col2' of SELECT #2 was resolved in SELECT #1 @@ -900,11 +900,11 @@ explain extended SELECT STRAIGHT_JOIN sq1.f2 FROM ( SELECT * FROM t1 ) AS sq1 WHERE EXISTS ( SELECT * FROM t1 AS sq2 WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -3 DEPENDENT SUBQUERY <subquery4> eq_ref distinct_key distinct_key 4 func 1 100.00 -3 DEPENDENT SUBQUERY sq2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -4 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT SUBQUERY <subquery4> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 DEPENDENT SUBQUERY sq2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +4 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1276 Field or reference 'sq1.pk' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'sq1.f1' of SELECT #3 was resolved in SELECT #1 @@ -920,11 +920,11 @@ explain extended SELECT STRAIGHT_JOIN sq1.f2 FROM ( SELECT * FROM t1 ) AS sq1 WHERE EXISTS ( SELECT * FROM t1 AS sq2 WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -3 DEPENDENT SUBQUERY <subquery4> eq_ref distinct_key distinct_key 4 func 1 100.00 -3 DEPENDENT SUBQUERY sq2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -4 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT SUBQUERY <subquery4> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 DEPENDENT SUBQUERY sq2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +4 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1276 Field or reference 'sq1.pk' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'sq1.f1' of SELECT #3 was resolved in SELECT #1 @@ -1115,9 +1115,9 @@ create table t2 (a int, b int); insert into t2 select a,a from t11; create table t3 as select * from t2; explain select * from t1 where exists (select t2.a from t2 left join t3 on (t3.b=t1.b) where t2.a=t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 -1 PRIMARY t2 ALL NULL NULL NULL NULL 1000 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 1000 Using where; End temporary; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1000 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1000 Using where; End temporary; Using join buffer (incremental, BNL join) drop table t1, t2, t3, t10, t11; set optimizer_switch=default; diff --git a/mysql-test/main/subselect_exists2in_costmat.result b/mysql-test/main/subselect_exists2in_costmat.result index 1c9574aafd3..49eedc9c6d5 100644 --- a/mysql-test/main/subselect_exists2in_costmat.result +++ b/mysql-test/main/subselect_exists2in_costmat.result @@ -63,9 +63,9 @@ WHERE (EXISTS (select 1 from City where City.Population > 100000 and Code = Country) OR Name LIKE 'L%') AND surfacearea > 1000000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country ALL Name,SurfaceArea NULL NULL NULL 239 Using where -2 MATERIALIZED City ALL Population,Country NULL NULL NULL 4079 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL ALL Name,SurfaceArea NULL NULL NULL 239 Using where +2 MATERIALIZED City NULL ALL Population,Country NULL NULL NULL 4079 Using where SELECT Name FROM Country WHERE (EXISTS (select 1 from City where City.Population > 100000 and Code = Country) OR diff --git a/mysql-test/main/subselect_extra.result b/mysql-test/main/subselect_extra.result index c654fdfca13..c0c7ceab771 100644 --- a/mysql-test/main/subselect_extra.result +++ b/mysql-test/main/subselect_extra.result @@ -14,17 +14,17 @@ insert into t1 values ('2001-01-01 1:1:1', '1:1:1'), insert into t2 values ('2001-01-01 1:1:1'), ('2001-01-01 1:1:1'); flush tables; EXPLAIN SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN (SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.dt IS NULL ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY OUTR ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY INNR ALL NULL NULL NULL NULL 2 Using where; FirstMatch(OUTR); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY OUTR NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY INNR NULL ALL NULL NULL NULL NULL 2 Using where; FirstMatch(OUTR); Using join buffer (flat, BNL join) flush tables; SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN (SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.dt IS NULL ); dt flush tables; EXPLAIN SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY OUTR ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY INNR ALL NULL NULL NULL NULL 2 Using where; FirstMatch(OUTR); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY OUTR NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY INNR NULL ALL NULL NULL NULL NULL 2 Using where; FirstMatch(OUTR); Using join buffer (flat, BNL join) flush tables; SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' ); dt @@ -42,8 +42,8 @@ insert into t2 (id, cur_date) values (1, '2007-04-25'); explain extended select * from t1 where id in (select id from t1 as x1 where (t1.cur_date is null)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1 Note 1003 select 1 AS `id`,'2007-04-25 18:30:22' AS `cur_date` from (dual) where 0 @@ -53,8 +53,8 @@ id cur_date explain extended select * from t2 where id in (select id from t2 as x1 where (t2.cur_date is null)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1 Note 1003 select 1 AS `id`,'2007-04-25' AS `cur_date` from (dual) where 0 @@ -66,9 +66,9 @@ insert into t2 (id, cur_date) values (2, '2007-04-26'); explain extended select * from t1 where id in (select id from t1 as x1 where (t1.cur_date is null)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -1 PRIMARY x1 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY x1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` semi join (`test`.`t1` `x1`) where `test`.`x1`.`id` = `test`.`t1`.`id` and `test`.`t1`.`cur_date` = 0 @@ -78,9 +78,9 @@ id cur_date explain extended select * from t2 where id in (select id from t2 as x1 where (t2.cur_date is null)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 PRIMARY x1 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t2); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY x1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t2); Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` semi join (`test`.`t2` `x1`) where `test`.`x1`.`id` = `test`.`t2`.`id` and `test`.`t2`.`cur_date` = 0 @@ -229,10 +229,10 @@ where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.b) and t2.c > 'b1' ) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index -2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index -2 DEPENDENT SUBQUERY t3 index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 128 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 164 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2); Using join buffer (flat, BNL join) select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.b) and @@ -260,10 +260,10 @@ where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.c) and t2.c > 'b1' ) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index -2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index -2 DEPENDENT SUBQUERY t3 index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 128 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 164 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2); Using join buffer (flat, BNL join) select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.c) and @@ -309,24 +309,24 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT 1 FROM t1 WHERE a IN (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index PRIMARY,i2 PRIMARY 4 NULL 144 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index PRIMARY,i2 PRIMARY 4 NULL 144 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 144 CREATE TABLE t2 (a INT, b INT, KEY(a)); INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4); EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 5 NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 5 NULL 2 EXPLAIN SELECT a, SUM(b) FROM t2 IGNORE INDEX (a) GROUP BY a LIMIT 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 Using temporary; Using filesort EXPLAIN SELECT 1 FROM t2 WHERE a IN (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index a a 5 NULL 4 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 144 DROP TABLE t1, t2; # # From derived_view.test @@ -348,10 +348,10 @@ NULL 0 0 EXPLAIN EXTENDED SELECT * FROM t2 RIGHT JOIN (SELECT * FROM t1) AS t ON t.a != 0 WHERE t.a IN (SELECT b FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` semi join (dual) where 1 SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0 @@ -361,10 +361,10 @@ NULL 0 0 EXPLAIN EXTENDED SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0 WHERE t.a IN (SELECT b FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` semi join (dual) where 1 DROP VIEW v1; @@ -391,10 +391,10 @@ a 2 EXPLAIN SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY <derived3> ref key0 key0 10 test.t1.a,test.t1.b 2 FirstMatch(t1) -3 DERIVED t2 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived3> NULL ref key0 key0 10 test.t1.a,test.t1.b 2 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 Using temporary; Using filesort SELECT * FROM v2; a b 9 3 @@ -411,12 +411,12 @@ a 2 EXPLAIN SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY <derived3> ref key0 key0 10 test.t1.a,test.t1.b 1 FirstMatch(t1) -3 DERIVED t2 ALL NULL NULL NULL NULL 6 -4 UNION t3 ALL NULL NULL NULL NULL 4 -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived3> NULL ref key0 key0 10 test.t1.a,test.t1.b 1 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 +4 UNION t3 NULL ALL NULL NULL NULL NULL 4 +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL DROP VIEW v1,v2; DROP TABLE t1,t2,t3; # @@ -434,11 +434,11 @@ EXPLAIN SELECT * FROM t3 WHERE t3.b IN (SELECT v1.b FROM v1, t2 WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 3 Using where; FirstMatch(t3); Using join buffer (flat, BNL join) -3 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 3 Using where; FirstMatch(t3); Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * FROM t3 WHERE t3.b IN (SELECT v1.b FROM v1, t2 WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c); @@ -449,11 +449,11 @@ EXPLAIN SELECT * FROM t3 WHERE t3.b IN (SELECT v1.b FROM v1, t2 WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY <derived3> ref key1 key1 8 const,const 0 Start temporary -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (flat, BNL join) -3 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY <derived3> NULL ref key1 key1 8 const,const 0 Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * FROM t3 WHERE t3.b IN (SELECT v1.b FROM v1, t2 WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c); @@ -472,10 +472,10 @@ CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; SET SESSION optimizer_switch='derived_with_keys=on'; EXPLAIN SELECT * FROM t1 WHERE t1.b IN (SELECT v2.a FROM v2 WHERE v2.b = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY <derived3> ref key0 key0 10 test.t1.b,test.t1.a 2 FirstMatch(t1) -3 DERIVED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived3> NULL ref key0 key0 10 test.t1.b,test.t1.a 2 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE t1.b IN (SELECT v2.a FROM v2 WHERE v2.b = t1.a); a b 5 4 diff --git a/mysql-test/main/subselect_extra_no_semijoin.result b/mysql-test/main/subselect_extra_no_semijoin.result index faeaf75c590..332367afaba 100644 --- a/mysql-test/main/subselect_extra_no_semijoin.result +++ b/mysql-test/main/subselect_extra_no_semijoin.result @@ -16,17 +16,17 @@ insert into t1 values ('2001-01-01 1:1:1', '1:1:1'), insert into t2 values ('2001-01-01 1:1:1'), ('2001-01-01 1:1:1'); flush tables; EXPLAIN SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN (SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.dt IS NULL ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY OUTR ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY INNR ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY OUTR NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY INNR NULL ALL NULL NULL NULL NULL 2 Using where flush tables; SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN (SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.dt IS NULL ); dt flush tables; EXPLAIN SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY OUTR ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY INNR ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY OUTR NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY INNR NULL ALL NULL NULL NULL NULL 2 Using where flush tables; SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' ); dt @@ -44,9 +44,9 @@ insert into t2 (id, cur_date) values (1, '2007-04-25'); explain extended select * from t1 where id in (select id from t1 as x1 where (t1.cur_date is null)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select 1 AS `id`,'2007-04-25 18:30:22' AS `cur_date` from dual where <expr_cache><1>(<in_optimizer>(1,<exists>(/* select#2 */ select `test`.`x1`.`id` from `test`.`t1` `x1` where 0))) @@ -56,9 +56,9 @@ id cur_date explain extended select * from t2 where id in (select id from t2 as x1 where (t2.cur_date is null)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select 1 AS `id`,'2007-04-25' AS `cur_date` from dual where <expr_cache><1>(<in_optimizer>(1,<exists>(/* select#2 */ select `test`.`x1`.`id` from `test`.`t2` `x1` where 0))) @@ -70,9 +70,9 @@ insert into t2 (id, cur_date) values (2, '2007-04-26'); explain extended select * from t1 where id in (select id from t1 as x1 where (t1.cur_date is null)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY x1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY x1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` where <expr_cache><`test`.`t1`.`id`,`test`.`t1`.`cur_date`>(<in_optimizer>(`test`.`t1`.`id`,<exists>(/* select#2 */ select `test`.`x1`.`id` from `test`.`t1` `x1` where `test`.`t1`.`cur_date` = 0 and <cache>(`test`.`t1`.`id`) = `test`.`x1`.`id`))) @@ -82,9 +82,9 @@ id cur_date explain extended select * from t2 where id in (select id from t2 as x1 where (t2.cur_date is null)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY x1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY x1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`,`test`.`t2`.`cur_date`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(/* select#2 */ select `test`.`x1`.`id` from `test`.`t2` `x1` where `test`.`t2`.`cur_date` = 0 and <cache>(`test`.`t2`.`id`) = `test`.`x1`.`id`))) @@ -233,10 +233,10 @@ where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.b) and t2.c > 'b1' ) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index -2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index -3 DEPENDENT SUBQUERY t3 index NULL idx_t3_1 10 NULL 192 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 128 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 164 Using where; Using index +3 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 Using where; Using index select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.b) and @@ -264,10 +264,10 @@ where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.c) and t2.c > 'b1' ) group by a1,a2,b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index -2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index -3 DEPENDENT SUBQUERY t3 index NULL idx_t3_1 10 NULL 192 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 128 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 164 Using where; Using index +3 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 Using where; Using index select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 where t2.c in (select c from t3 where t3.c > t1.c) and @@ -313,22 +313,22 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT 1 FROM t1 WHERE a IN (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 144 Using where; Using index -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 144 Using where; Using index +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 144 CREATE TABLE t2 (a INT, b INT, KEY(a)); INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4); EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL a 5 NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL index NULL a 5 NULL 2 EXPLAIN SELECT a, SUM(b) FROM t2 IGNORE INDEX (a) GROUP BY a LIMIT 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 Using temporary; Using filesort EXPLAIN SELECT 1 FROM t2 WHERE a IN (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index NULL a 5 NULL 4 Using where; Using index -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index NULL a 5 NULL 4 Using where; Using index +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 144 DROP TABLE t1, t2; # # From derived_view.test @@ -350,10 +350,10 @@ NULL 0 0 EXPLAIN EXTENDED SELECT * FROM t2 RIGHT JOIN (SELECT * FROM t1) AS t ON t.a != 0 WHERE t.a IN (SELECT b FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -3 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <expr_cache><0>(<in_optimizer>(0,<exists>(/* select#3 */ select 0 from dual where <cache>(0) = 0))) SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0 @@ -363,10 +363,10 @@ NULL 0 0 EXPLAIN EXTENDED SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0 WHERE t.a IN (SELECT b FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,0 AS `a`,0 AS `b` from `test`.`t2` where <expr_cache><0>(<in_optimizer>(0,<exists>(/* select#2 */ select 0 from dual where <cache>(0) = 0))) DROP VIEW v1; @@ -393,10 +393,10 @@ a 2 EXPLAIN SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 10 func,func 2 Using where -3 DERIVED t2 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY <derived3> NULL index_subquery key0 key0 10 func,func 2 Using where +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 Using temporary; Using filesort SELECT * FROM v2; a b 9 3 @@ -413,12 +413,12 @@ a 2 EXPLAIN SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 10 func,func 1 Using where -3 DERIVED t2 ALL NULL NULL NULL NULL 6 -4 UNION t3 ALL NULL NULL NULL NULL 4 -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY <derived3> NULL index_subquery key0 key0 10 func,func 1 Using where +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 +4 UNION t3 NULL ALL NULL NULL NULL NULL 4 +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL DROP VIEW v1,v2; DROP TABLE t1,t2,t3; # @@ -436,11 +436,11 @@ EXPLAIN SELECT * FROM t3 WHERE t3.b IN (SELECT v1.b FROM v1, t2 WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 3 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 3 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * FROM t3 WHERE t3.b IN (SELECT v1.b FROM v1, t2 WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c); @@ -451,11 +451,11 @@ EXPLAIN SELECT * FROM t3 WHERE t3.b IN (SELECT v1.b FROM v1, t2 WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY <derived3> ref key1 key1 8 const,const 0 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY <derived3> NULL ref key1 key1 8 const,const 0 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * FROM t3 WHERE t3.b IN (SELECT v1.b FROM v1, t2 WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c); @@ -474,10 +474,10 @@ CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; SET SESSION optimizer_switch='derived_with_keys=on'; EXPLAIN SELECT * FROM t1 WHERE t1.b IN (SELECT v2.a FROM v2 WHERE v2.b = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY <derived3> ref key0 key0 5 test.t1.a 2 Using where -3 DERIVED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY <derived3> NULL ref key0 key0 5 test.t1.a 2 Using where +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE t1.b IN (SELECT v2.a FROM v2 WHERE v2.b = t1.a); a b 5 4 diff --git a/mysql-test/main/subselect_innodb.result b/mysql-test/main/subselect_innodb.result index abc429fb550..a77fdf5dd9f 100644 --- a/mysql-test/main/subselect_innodb.result +++ b/mysql-test/main/subselect_innodb.result @@ -310,10 +310,10 @@ SELECT 1 FROM t1 WHERE NOT EXISTS 1 EXPLAIN SELECT 1 FROM t1 WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE d = (SELECT d FROM t2 WHERE a >= 1) ORDER BY d); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 1 Using where -2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY,d PRIMARY 1 func 1 Using where -3 DEPENDENT SUBQUERY t2 index NULL d 2 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 1 Using where +2 DEPENDENT SUBQUERY t2 NULL unique_subquery PRIMARY,d PRIMARY 1 func 1 Using where +3 DEPENDENT SUBQUERY t2 NULL index NULL d 2 NULL 1 Using index DROP TABLE t2; CREATE TABLE t2 (b INT, c INT, UNIQUE KEY (b), UNIQUE KEY (b, c )) ENGINE=INNODB; INSERT INTO t2 VALUES (1, 1); @@ -343,9 +343,9 @@ LIMIT 10,1 ) AS maxkey FROM t1 LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ref t1_id,t1_id_position t1_id_position 5 test.t1.id 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ref t1_id,t1_id_position t1_id_position 5 test.t1.id 1 Using where; Using index SELECT (SELECT position FROM t2 WHERE t2.t1_id = t1.id @@ -370,10 +370,10 @@ WHERE t1.a = ( SELECT SUM( c ) FROM t2 WHERE (SELECT DISTINCT b FROM t3) > 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 SUBQUERY t3 ALL NULL NULL NULL NULL 1 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 1 Using temporary SELECT * FROM t1 WHERE t1.a = ( @@ -399,10 +399,10 @@ FROM t3 GROUP BY 1 ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 SUBQUERY t3 ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 1 SELECT MAX( f1 ) FROM t2 WHERE f2 >= ( SELECT SUM( f1 ) @@ -423,10 +423,10 @@ create table t1(a1 int) ENGINE=InnoDB; insert into t1 values (1); explain select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 group by a1)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 1 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 1 -3 SUBQUERY t1 ALL NULL NULL NULL NULL 1 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 1 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 1 +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 1 Using temporary; Using filesort select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 group by a1)); 1 1 @@ -456,10 +456,10 @@ CREATE TABLE t2 (b INT PRIMARY KEY, c INT) ENGINE=InnoDB; CREATE TABLE t3 (d INT) ENGINE=InnoDB; EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT b FROM t2, t3 GROUP BY b HAVING b != 3 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t2 index NULL PRIMARY 4 NULL 1 Using index; Using temporary -2 SUBQUERY t3 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t2 NULL index NULL PRIMARY 4 NULL 1 Using index; Using temporary +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE EXISTS ( SELECT b FROM t2, t3 GROUP BY b HAVING b != 3 ); a DROP TABLE t1,t2,t3; @@ -478,10 +478,10 @@ t1 AS SQ2_alias2 ON (SQ2_alias2 . col_int_key = SQ2_alias1 . col_int_key ) GROUP BY SQ2_field1 HAVING SQ2_alias1 . col_int_key >= 7 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY SQ2_alias2 index NULL col_int_key 5 NULL 1 Using index; Using temporary -2 SUBQUERY SQ2_alias1 ref col_int_key col_int_key 5 test.SQ2_alias2.col_int_key 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY SQ2_alias2 NULL index NULL col_int_key 5 NULL 1 Using index; Using temporary +2 SUBQUERY SQ2_alias1 NULL ref col_int_key col_int_key 5 test.SQ2_alias2.col_int_key 1 Using where; Using index SELECT 1 FROM t1 AS alias1 WHERE EXISTS ( SELECT SQ2_alias1 . col_int_key AS SQ2_field1 FROM ( t1 AS SQ2_alias1 RIGHT OUTER JOIN @@ -550,9 +550,9 @@ WHERE t2.key1 = t1.a ORDER BY t2.id ASC LIMIT 1) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 -2 DEPENDENT SUBQUERY t2 ref key1 key1 5 test.t1.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 +2 DEPENDENT SUBQUERY t2 NULL ref key1 key1 5 test.t1.a 1 Using where # # MDEV-6081: ORDER BY+ref(const): selectivity is very incorrect (MySQL Bug#14338686) # @@ -573,9 +573,9 @@ WHERE t2.key1 = t1.a ORDER BY t2.key2 ASC LIMIT 1) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL # -2 DEPENDENT SUBQUERY t2 ref key1 key1 5 test.t1.a # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL # +2 DEPENDENT SUBQUERY t2 NULL ref key1 key1 5 test.t1.a # Using where; Using filesort drop table t1,t2; # # mdev-12931: semi-join in ON expression of STRAIGHT_JOIN @@ -607,12 +607,12 @@ INNER JOIN ( t2 STRAIGHT_JOIN ( SELECT * FROM t3 ) AS sq ON ( 1 IN ( SELECT f4 FROM t4 ) ) ) ON ( f1 >= f2 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join) -3 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join) +3 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t2`.`f2` AS `f2`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` join `test`.`t2` semi join (`test`.`t4`) join `test`.`t3` where `test`.`t4`.`f4` = 1 and `test`.`t1`.`f1` >= `test`.`t2`.`f2` DROP TABLE t1,t2,t3,t4; @@ -646,9 +646,9 @@ SELECT * FROM t1 WHERE a = b AND (a,b) IN (SELECT t2.x, COUNT(t2.y) FROM t2 WHERE 1=2 GROUP BY t2.x);"; execute stmt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (/* select#2 */ select `test`.`t2`.`x`,count(`test`.`t2`.`y`) from `test`.`t2` where 0 group by `test`.`t2`.`x` having `COUNT(t2.y)` = `test`.`t2`.`x`) join `test`.`t1` where 0 # here re-execution of the pushdown does not crash: diff --git a/mysql-test/main/subselect_innodb.test b/mysql-test/main/subselect_innodb.test index 19871e14008..d0141b43938 100644 --- a/mysql-test/main/subselect_innodb.test +++ b/mysql-test/main/subselect_innodb.test @@ -564,7 +564,7 @@ alter table t2 add key(key2); analyze table t2; flush tables; --echo # Table tsubq must use 'ref' + Using filesort (not 'index' w/o filesort) ---replace_column 9 # +--replace_column 10 # explain select (SELECT concat(id, '-', key1, '-', col1) diff --git a/mysql-test/main/subselect_mat.result b/mysql-test/main/subselect_mat.result index 980db9f3ee1..c071d82dc97 100644 --- a/mysql-test/main/subselect_mat.result +++ b/mysql-test/main/subselect_mat.result @@ -59,9 +59,9 @@ set @@optimizer_switch='materialization=on,in_to_exists=off,firstmatch=off'; # non-indexed nullable fields explain extended select * from t1 where a1 in (select b1 from t2 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (/* select#2 */ select `test`.`t2`.`b1` from `test`.`t2` where `test`.`t2`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1`)))) select * from t1 where a1 in (select b1 from t2 where b1 > '0'); @@ -70,9 +70,9 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (/* select#2 */ select `test`.`t2`.`b1` from `test`.`t2` where `test`.`t2`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1`)))) select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1); @@ -81,9 +81,9 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`b2`)))) select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2); @@ -92,9 +92,9 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`b1` > '0' group by `test`.`t2`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`min(b2)`)))) select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1); @@ -103,9 +103,9 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1i where a1 in (select b1 from t2i where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1i index NULL _it1_idx # NULL 3 100.00 Using where; -2 MATERIALIZED t2i range it2i1,it2i3 it2i1 # NULL 5 100.00 Using where; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL index NULL _it1_idx # NULL 3 100.00 Using where; +2 MATERIALIZED t2i NULL range it2i1,it2i3 it2i1 # NULL 5 100.00 Using where; Warnings: Note 1003 /* select#1 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`>(<in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (/* select#2 */ select `test`.`t2i`.`b1` from `test`.`t2i` where `test`.`t2i`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`b1`)))) select * from t1i where a1 in (select b1 from t2i where b1 > '0'); @@ -114,9 +114,9 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1i index NULL # 18 # 3 100.00 # -2 MATERIALIZED t2i range it2i1,it2i3 # 9 # 5 100.00 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL index NULL # 18 # 3 100.00 # +2 MATERIALIZED t2i NULL range it2i1,it2i3 # 9 # 5 100.00 # Warnings: Note 1003 /* select#1 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`>(<in_optimizer>(`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( <materialize> (/* select#2 */ select max(`test`.`t2i`.`b1`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`max(b1)`)))) select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1); @@ -125,9 +125,9 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1i index NULL _it1_idx # NULL 3 100.00 Using where; -2 MATERIALIZED t2i range it2i1,it2i3 it2i3 # NULL 5 100.00 Using where; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL index NULL _it1_idx # NULL 3 100.00 Using where; +2 MATERIALIZED t2i NULL range it2i1,it2i3 it2i3 # NULL 5 100.00 Using where; Warnings: Note 1003 /* select#1 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`b1` and `test`.`t1i`.`a2` = `<subquery2>`.`b2`)))) select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0'); @@ -136,9 +136,9 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1i index NULL # # # 3 100.00 # -2 MATERIALIZED t2i range it2i1,it2i3 # # # 5 100.00 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL index NULL # # # 3 100.00 # +2 MATERIALIZED t2i NULL range it2i1,it2i3 # # # 5 100.00 # Warnings: Note 1003 /* select#1 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`b1` and `test`.`t1i`.`a2` = `<subquery2>`.`max(b2)`)))) select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1); @@ -147,9 +147,9 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1i index NULL # # # 3 100.00 # -2 MATERIALIZED t2i range it2i1,it2i3 # # # 5 100.00 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL index NULL # # # 3 100.00 # +2 MATERIALIZED t2i NULL range it2i1,it2i3 # # # 5 100.00 # Warnings: Note 1003 /* select#1 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`b1` and `test`.`t1i`.`a2` = `<subquery2>`.`min(b2)`)))) select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); @@ -176,9 +176,9 @@ t2i_c CREATE TABLE `t2i_c` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 explain extended select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 4 100.00 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2i_c NULL range NULL it2i3 9 NULL 4 100.00 Using index for group-by Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2i_c`.`b1`,max(`test`.`t2i_c`.`b2`) from `test`.`t2i_c` group by `test`.`t2i_c`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`max(b2)`)))) select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1); @@ -187,13 +187,13 @@ a1 a2 1 - 02 2 - 02 prepare st1 from "explain select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1)"; execute st1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 4 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +2 MATERIALIZED t2i_c NULL range NULL it2i3 9 NULL 4 Using index for group-by execute st1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 4 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +2 MATERIALIZED t2i_c NULL range NULL it2i3 9 NULL 4 Using index for group-by prepare st2 from "select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1)"; execute st2; a1 a2 @@ -206,9 +206,9 @@ a1 a2 drop table t2i_c; explain extended select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2i range it2i1,it2i3 it2i3 9 NULL 5 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2i NULL range it2i1,it2i3 it2i3 9 NULL 5 100.00 Using where; Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`min(b2)`)))) select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); @@ -253,9 +253,9 @@ a1 a2 set @@optimizer_switch=@local_optimizer_switch; explain extended select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`b2`)))) select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2); @@ -264,9 +264,9 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1i index NULL it1i3 18 NULL 3 100.00 Using where; Using index -2 MATERIALIZED t2i index NULL it2i3 18 NULL 5 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL index NULL it1i3 18 NULL 3 100.00 Using where; Using index +2 MATERIALIZED t2i NULL index NULL it2i3 18 NULL 5 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`b1` and `test`.`t1i`.`a2` = `<subquery2>`.`b2`)))) select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2); @@ -317,11 +317,11 @@ select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and (a1, a2) in (select c1, c2 from t3 where (c1, c2) in (select b1, b2 from t2i where b2 > '0')); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -4 MATERIALIZED t2i index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +4 MATERIALIZED t2i NULL index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`b2`)))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#3 */ select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (/* select#4 */ select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t 2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where `test`.`t3`.`c1` = `<subquery4>`.`b1` and `test`.`t3`.`c2` = `<subquery4>`.`b2`)))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery3>`.`c1` and `test`.`t1`.`a2` = `<subquery3>`.`c2`)))) select * from t1 @@ -336,11 +336,11 @@ select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and (a1, a2) in (select c1, c2 from t3i where (c1, c2) in (select b1, b2 from t2i where b2 > '0')); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1i index NULL # # # 3 100.00 # -3 MATERIALIZED t3i index NULL # # # 4 100.00 # -4 MATERIALIZED t2i index it2i2 # # # 5 100.00 # -2 MATERIALIZED t2i range it2i1,it2i3 # # # 5 100.00 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL index NULL # # # 3 100.00 # +3 MATERIALIZED t3i NULL index NULL # # # 4 100.00 # +4 MATERIALIZED t2i NULL index it2i2 # # # 5 100.00 # +2 MATERIALIZED t2i NULL range it2i1,it2i3 # # # 5 100.00 # Warnings: Note 1003 /* select#1 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`b1` and `test`.`t1i`.`a2` = `<subquery2>`.`b2`)))) and <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (/* select#3 */ select `test`.`t3i`.`c1`,`test`.`t3i`.`c2` from `test`.`t3i` where <expr_cache><`test`.`t3i`.`c1`,`test`.`t3i`.`c2`>(<in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (/* select#4 */ select `test`.`t2i`.`b1`,` test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key where `test`.`t3i`.`c1` = `<subquery4>`.`b1` and `test`.`t3i`.`c2` = `<subquery4>`.`b2`)))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery3>`.`c1` and `test`.`t1i`.`a2` = `<subquery3>`.`c2`)))) select * from t1i @@ -357,13 +357,13 @@ where b2 in (select c2 from t3 where c2 LIKE '%02') or b2 in (select c2 from t3 where c2 LIKE '%03')) and (a1, a2) in (select c1, c2 from t3 where (c1, c2) in (select b1, b2 from t2i where b2 > '0')); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -5 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -6 MATERIALIZED t2i index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where -4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +5 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +6 MATERIALIZED t2i NULL index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +4 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (/* select#3 */ select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%02' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery3>`.`c2`)))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (/* select#4 */ select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`)))) ), <primary_index_l ookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`b2`)))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#5 */ select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (/* select#6 */ select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where `test`.`t3`.`c1` = `<subquery6>`.`b1` and `test`.`t3`.`c2` = `<subquery6>`.`b2`)))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery5>`.`c1` and `test`.`t1`.`a2` = `<subquery5>`.`c2`)))) select * from t1 @@ -381,13 +381,13 @@ where b2 in (select c2 from t3 t3a where c1 = a1) or b2 in (select c2 from t3 t3b where c2 LIKE '%03')) and (a1, a2) in (select c1, c2 from t3 t3c where (c1, c2) in (select b1, b2 from t2i where b2 > '0')); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -5 MATERIALIZED t3c ALL NULL NULL NULL NULL 4 100.00 Using where -6 MATERIALIZED t2i index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where -4 MATERIALIZED t3b ALL NULL NULL NULL NULL 4 100.00 Using where -3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +5 MATERIALIZED t3c NULL ALL NULL NULL NULL NULL 4 100.00 Using where +6 MATERIALIZED t2i NULL index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +4 MATERIALIZED t3b NULL ALL NULL NULL NULL NULL 4 100.00 Using where +3 DEPENDENT SUBQUERY t3a NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(/* select#2 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(/* select#3 */ select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where `test`.`t3a`.`c1` = `test`.`t1`.`a1` and <cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (/* select#4 */ select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where `test`.`t3b`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`))))) and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1` and <cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and <expr_cache><`test`.` t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#5 */ select `test`.`t3c`.`c1`,`test`.`t3c`.`c2` from `test`.`t3` `t3c` where <expr_cache><`test`.`t3c`.`c1`,`test`.`t3c`.`c2`>(<in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),(`test`.`t3c`.`c1`,`test`.`t3c`.`c2`) in ( <materialize> (/* select#6 */ select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3c`.`c1` in <temporary table> on distinct_key where `test`.`t3c`.`c1` = `<subquery6>`.`b1` and `test`.`t3c`.`c2` = `<subquery6>`.`b2`)))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery5>`.`c1` and `test`.`t1`.`a2` = `<subquery5>`.`c2`)))) @@ -413,18 +413,18 @@ UNION where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and (a1, a2) in (select c1, c2 from t3i where (c1, c2) in (select b1, b2 from t2i where b2 > '0'))); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL # # # 3 100.00 # -5 MATERIALIZED t3 ALL NULL # # # 4 100.00 # -6 MATERIALIZED t2i index it2i2 # # # 5 100.00 # -2 MATERIALIZED t2 ALL NULL # # # 5 100.00 # -4 MATERIALIZED t3 ALL NULL # # # 4 100.00 # -3 MATERIALIZED t3 ALL NULL # # # 4 100.00 # -7 UNION t1i index NULL # # # 3 100.00 # -9 MATERIALIZED t3i index NULL # # # 4 100.00 # -10 MATERIALIZED t2i index it2i2 # # # 5 100.00 # -8 MATERIALIZED t2i range it2i1,it2i3 # # # 5 100.00 # -NULL UNION RESULT <union1,7> ALL NULL # # # NULL NULL # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL # # # 3 100.00 # +5 MATERIALIZED t3 NULL ALL NULL # # # 4 100.00 # +6 MATERIALIZED t2i NULL index it2i2 # # # 5 100.00 # +2 MATERIALIZED t2 NULL ALL NULL # # # 5 100.00 # +4 MATERIALIZED t3 NULL ALL NULL # # # 4 100.00 # +3 MATERIALIZED t3 NULL ALL NULL # # # 4 100.00 # +7 UNION t1i NULL index NULL # # # 3 100.00 # +9 MATERIALIZED t3i NULL index NULL # # # 4 100.00 # +10 MATERIALIZED t2i NULL index it2i2 # # # 5 100.00 # +8 MATERIALIZED t2i NULL range it2i1,it2i3 # # # 5 100.00 # +NULL UNION RESULT <union1,7> NULL ALL NULL # # # NULL NULL # Warnings: Note 1003 (/* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (/* select#3 */ select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%02' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery3>`.`c2`)))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (/* select#4 */ select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`)))) ), <primary_index_ lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`b2`)))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#5 */ select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (/* select#6 */ select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where `test`.`t3`.`c1` = `<subquery6>`.`b1` and `test`.`t3`.`c2` = `<subquery6>`.`b2`)))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery5>`.`c1` and `test`.`t1`.`a2` = `<subquery5>`.`c2`))))) union (/* select#7 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (/* select#8 */ select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery8>`.`b1` and `test`.`t1i`.`a2` = `<subquery8>`.`b2`)))) and <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (/* select#9 */ select `test`.`t3i`.`c1`,`test`.`t3i`.`c2` from `test`.`t3i` where <expr_cache><`test`.`t3i`.`c1`,`test`.`t3i`.`c2`>(<in_optimizer>((`test`.`t3i`.`c1`,`test`.`t3i`.`c2`),(`test`.`t3i`.`c1`,`test`.`t3i`.`c2`) in ( <materialize> (/* select#10 */ select `test`.`t2i`.`b1`,`test`.` t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3i`.`c1` in <temporary table> on distinct_key where `test`.`t3i`.`c1` = `<subquery10>`.`b1` and `test`.`t3i`.`c2` = `<subquery10>`.`b2`)))) ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery9>`.`c1` and `test`.`t1i`.`a2` = `<subquery9>`.`c2`))))) (select * from t1 @@ -447,13 +447,13 @@ select * from t1 where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and (a1, a2) in (select c1, c2 from t3 where (c1, c2) in (select b1, b2 from t2i where b2 > '0')); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -5 MATERIALIZED t2i index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +4 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +5 MATERIALIZED t2i NULL index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +3 DEPENDENT UNION t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(/* select#2 */ select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and <cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1` and <cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2` union /* select#3 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1` and <cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#4 */ select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (/* select#5 */ select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where `test`.`t3`.`c1` = `<subquery5>`.`b1` and `test`.`t3`.`c2` = `<subquery5>`.`b2`)))) ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery4>`.`c1` and `test`.`t1`.`a2` = `<subquery4>`.`c2`)))) select * from t1 @@ -469,14 +469,14 @@ where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where (c1, c2) in (select c1, c2 from t3 where (c1, c2) in (select b1, b2 from t2i where b2 > '0')) and a1 = c1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) -4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -5 MATERIALIZED t2i index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +4 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +5 MATERIALIZED t2i NULL index it2i2 it2i3 18 NULL 5 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +3 DEPENDENT UNION t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` join `test`.`t3` where `test`.`t3`.`c1` = `test`.`t1`.`a1` and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(/* select#2 */ select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and <cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1` and <cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2` union /* select#3 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1` and <cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and <expr_cache><`test`.`t3`.`c1`,`test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (/* select#4 */ select `test`.`t3`.`c1`,`test`.`t3`.`c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`, `test`.`t3`.`c2`>(<in_optimizer>((`test`.`t3`.`c1`,`test`.`t3`.`c2`),(`test`.`t3`.`c1`,`test`.`t3`.`c2`) in ( <materialize> (/* select#5 */ select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` where `test`.`t2i`.`b2` > '0' ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where `test`.`t3`.`c1` = `<subquery5>`.`b1` and `test`.`t3`.`c2` = `<subquery5>`.`b2`)))) ), <primary_index_lookup>(`test`.`t3`.`c1` in <temporary table> on distinct_key where `test`.`t3`.`c1` = `<subquery4>`.`c1` and `test`.`t3`.`c2` = `<subquery4>`.`c2`)))) select * from t1, t3 @@ -494,11 +494,11 @@ a1 a2 c1 c2 explain extended select * from t3 where c1 in (select a1 from t1 where a1 > '0' UNION select b1 from t2 where b1 < '9'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +3 DEPENDENT UNION t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`>(<in_optimizer>(`test`.`t3`.`c1`,<exists>(/* select#2 */ select `test`.`t1`.`a1` from `test`.`t1` where `test`.`t1`.`a1` > '0' and <cache>(`test`.`t3`.`c1`) = `test`.`t1`.`a1` union /* select#3 */ select `test`.`t2`.`b1` from `test`.`t2` where `test`.`t2`.`b1` < '9' and <cache>(`test`.`t3`.`c1`) = `test`.`t2`.`b1`))) select * from t3 @@ -514,22 +514,22 @@ where b2 in (select c2 from t3 t3a where c1 = a1) or b2 in (select c2 from t3 t3b where c2 LIKE '%03')) and (a1, a2) in (select c1, c2 from t3 t3c where (c1, c2) in (select b1, b2 from t2i where b2 > '0' or b2 = a2)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -5 DEPENDENT SUBQUERY t3c ALL NULL NULL NULL NULL 4 100.00 Using where -6 DEPENDENT SUBQUERY t2i index_subquery it2i1,it2i2,it2i3 it2i3 18 func,func 1 100.00 Using index; Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where -4 MATERIALIZED t3b ALL NULL NULL NULL NULL 4 100.00 Using where -3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +5 DEPENDENT SUBQUERY t3c NULL ALL NULL NULL NULL NULL 4 100.00 Using where +6 DEPENDENT SUBQUERY t2i NULL index_subquery it2i1,it2i2,it2i3 it2i3 18 func,func 1 100.00 Using index; Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +4 MATERIALIZED t3b NULL ALL NULL NULL NULL NULL 4 100.00 Using where +3 DEPENDENT SUBQUERY t3a NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a2' of SELECT #6 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(/* select#2 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(/* select#3 */ select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where `test`.`t3a`.`c1` = `test`.`t1`.`a1` and <cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (/* select#4 */ select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where `test`.`t3b`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`))))) and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1` and <cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and <expr_cache><`test`.` t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(/* select#5 */ select `test`.`t3c`.`c1`,`test`.`t3c`.`c2` from `test`.`t3` `t3c` where <expr_cache><`test`.`t3c`.`c1`,`test`.`t3c`.`c2`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t3c`.`c1`,`test`.`t3c`.`c2`),<exists>(<index_lookup>(<cache>(`test`.`t3c`.`c1`) in t2i on it2i3 where (`test`.`t2i`.`b2` > '0' or `test`.`t2i`.`b2` = `test`.`t1`.`a2`) and <cache>(`test`.`t3c`.`c1`) = `test`.`t2i`.`b1` and <cache>(`test`.`t3c`.`c2`) = `test`.`t2i`.`b2`)))) and <cache>(`test`.`t1`.`a1`) = `test`.`t3c`.`c1` and <cache>(`test`.`t1`.`a2`) = `test`.`t3c`.`c2`))) explain extended select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(/* select#2 */ select '1 - 01','2 - 01' having (<cache>(`test`.`t1`.`a1`) = '1 - 01' or /*always not null*/ 1 is null) and (<cache>(`test`.`t1`.`a2`) = '2 - 01' or /*always not null*/ 1 is null) and '1 - 01' is null and '2 - 01' is null))) select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01'); @@ -537,9 +537,9 @@ a1 a2 1 - 01 2 - 01 explain extended select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(/* select#2 */ select '1 - 01','2 - 01' having (<cache>(`test`.`t1`.`a1`) = '1 - 01' or /*always not null*/ 1 is null) and (<cache>(`test`.`t1`.`a2`) = '2 - 01' or /*always not null*/ 1 is null) and '1 - 01' is null and '2 - 01' is null))) select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual); @@ -559,9 +559,9 @@ create table columns (col int key); insert into columns values (1), (2); explain extended select * from t1 group by (select col from columns limit 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -2 SUBQUERY columns index NULL PRIMARY 4 NULL 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 SUBQUERY columns NULL index NULL PRIMARY 4 NULL 2 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by (/* select#2 */ select `test`.`columns`.`col` from `test`.`columns` limit 1) select * from t1 group by (select col from columns limit 1); @@ -569,9 +569,9 @@ a1 a2 1 - 00 2 - 00 explain extended select * from t1 group by (a1 in (select col from columns)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using temporary; Using filesort -2 DEPENDENT SUBQUERY columns unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using temporary; Using filesort +2 DEPENDENT SUBQUERY columns NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`a1`) in columns on PRIMARY where trigcond(<cache>(`test`.`t1`.`a1`) = `test`.`columns`.`col`))))) select * from t1 group by (a1 in (select col from columns)); @@ -584,9 +584,9 @@ Warning 1292 Truncated incorrect DOUBLE value: '1 - 02' /* ORDER BY clause */ explain extended select * from t1 order by (select col from columns limit 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -2 SUBQUERY columns index NULL PRIMARY 4 NULL 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 SUBQUERY columns NULL index NULL PRIMARY 4 NULL 2 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` order by (/* select#2 */ select `test`.`columns`.`col` from `test`.`columns` limit 1) select * from t1 order by (select col from columns limit 1); @@ -630,9 +630,9 @@ insert into t3_16 values explain extended select left(a1,7), left(a2,7) from t1_16 where a1 in (select b1 from t2_16 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,<exists>(/* select#2 */ select `test`.`t2_16`.`b1` from `test`.`t2_16` where `test`.`t2_16`.`b1` > '0' and <cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1`))) select left(a1,7), left(a2,7) @@ -644,9 +644,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_16 where (a1,a2) in (select b1, b2 from t2_16 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`>(<in_optimizer>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),<exists>(/* select#2 */ select `test`.`t2_16`.`b1`,`test`.`t2_16`.`b2` from `test`.`t2_16` where `test`.`t2_16`.`b1` > '0' and <cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1` and <cache>(`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`))) select left(a1,7), left(a2,7) @@ -658,9 +658,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_16 where a1 in (select substring(b1,1,16) from t2_16 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (/* select#2 */ select substr(`test`.`t2_16`.`b1`,1,16) from `test`.`t2_16` where `test`.`t2_16`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key where `test`.`t1_16`.`a1` = `<subquery2>`.`substring(b1,1,16)`)))) select left(a1,7), left(a2,7) @@ -672,9 +672,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_16 where a1 in (select group_concat(b1) from t2_16 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,<exists>(/* select#2 */ select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` having <cache>(`test`.`t1_16`.`a1`) = <ref_null_helper>(group_concat(`test`.`t2_16`.`b1` separator ','))))) select left(a1,7), left(a2,7) @@ -687,9 +687,9 @@ set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_16 where a1 in (select group_concat(b1) from t2_16 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,`test`.`t1_16`.`a1` in ( <materialize> (/* select#2 */ select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` ), <primary_index_lookup>(`test`.`t1_16`.`a1` in <temporary table> on distinct_key where `test`.`t1_16`.`a1` = `<subquery2>`.`group_concat(b1)`)))) select left(a1,7), left(a2,7) @@ -706,12 +706,12 @@ where (a1, a2) IN (select t2_16.b1, t2_16.b2 from t2_16, t2 where t2.b2 = substring(t2_16.b2,1,6) and t2.b1 IN (select c1 from t3 where c2 > '0'))); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where -3 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where -3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) -4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t1_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +3 DEPENDENT SUBQUERY t2_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +3 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +4 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><concat(`test`.`t1`.`a1`,'x')>(<in_optimizer>(concat(`test`.`t1`.`a1`,'x'),<exists>(/* select#2 */ select left(`test`.`t1_16`.`a1`,8) from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`>(<in_optimizer>((`test`.`t1_16`.`a1`,`test`.`t1_16`.`a2`),<exists>(/* select#3 */ select `test`.`t2_16`.`b1`,`test`.`t2_16`.`b2` from `test`.`t2_16` join `test`.`t2` where `test`.`t2`.`b2` = substr(`test`.`t2_16`.`b2`,1,6) and <expr_cache><`test`.`t2`.`b1`>(<in_optimizer>(`test`.`t2`.`b1`,`test`.`t2`.`b1` in ( <materialize> (/* select#4 */ select `test`.`t3`.`c1` from `test`.`t3` where `test`.`t3`.`c2` > '0' ), <primary_index_lookup>(`test`.`t2`.`b1` in <temporary table> on distinct_key where `test`.`t2`.`b1` = `<subquery4>`.`c1`)))) and <cache>(`test`.`t1_16`.`a1`) = `test`.`t2_16`.`b1` and <cache>(`test`.`t1_16`.`a2`) = `test`.`t2_16`.`b2`))) and <cache>(co ncat(`test`.`t1`.`a1`,'x')) = left(`test`.`t1_16`.`a1`,8)))) drop table t1_16, t2_16, t3_16; @@ -743,9 +743,9 @@ insert into t3_512 values explain extended select left(a1,7), left(a2,7) from t1_512 where a1 in (select b1 from t2_512 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`>(<in_optimizer>(`test`.`t1_512`.`a1`,<exists>(/* select#2 */ select `test`.`t2_512`.`b1` from `test`.`t2_512` where `test`.`t2_512`.`b1` > '0' and <cache>(`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1`))) select left(a1,7), left(a2,7) @@ -757,9 +757,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_512 where (a1,a2) in (select b1, b2 from t2_512 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`,`test`.`t1_512`.`a2`>(<in_optimizer>((`test`.`t1_512`.`a1`,`test`.`t1_512`.`a2`),<exists>(/* select#2 */ select `test`.`t2_512`.`b1`,`test`.`t2_512`.`b2` from `test`.`t2_512` where `test`.`t2_512`.`b1` > '0' and <cache>(`test`.`t1_512`.`a1`) = `test`.`t2_512`.`b1` and <cache>(`test`.`t1_512`.`a2`) = `test`.`t2_512`.`b2`))) select left(a1,7), left(a2,7) @@ -771,9 +771,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_512 where a1 in (select substring(b1,1,512) from t2_512 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`>(<in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (/* select#2 */ select substr(`test`.`t2_512`.`b1`,1,512) from `test`.`t2_512` where `test`.`t2_512`.`b1` > '0' ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where `test`.`t1_512`.`a1` = `<subquery2>`.`substring(b1,1,512)`)))) select left(a1,7), left(a2,7) @@ -785,9 +785,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`>(<in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (/* select#2 */ select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where `test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)`)))) select left(a1,7), left(a2,7) @@ -802,9 +802,9 @@ set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` where <expr_cache><`test`.`t1_512`.`a1`>(<in_optimizer>(`test`.`t1_512`.`a1`,`test`.`t1_512`.`a1` in ( <materialize> (/* select#2 */ select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2` ), <primary_index_lookup>(`test`.`t1_512`.`a1` in <temporary table> on distinct_key where `test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)`)))) select left(a1,7), left(a2,7) @@ -844,9 +844,9 @@ insert into t3_1024 values explain extended select left(a1,7), left(a2,7) from t1_1024 where a1 in (select b1 from t2_1024 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`>(<in_optimizer>(`test`.`t1_1024`.`a1`,<exists>(/* select#2 */ select `test`.`t2_1024`.`b1` from `test`.`t2_1024` where `test`.`t2_1024`.`b1` > '0' and <cache>(`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1`))) select left(a1,7), left(a2,7) @@ -858,9 +858,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_1024 where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a2`>(<in_optimizer>((`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a2`),<exists>(/* select#2 */ select `test`.`t2_1024`.`b1`,`test`.`t2_1024`.`b2` from `test`.`t2_1024` where `test`.`t2_1024`.`b1` > '0' and <cache>(`test`.`t1_1024`.`a1`) = `test`.`t2_1024`.`b1` and <cache>(`test`.`t1_1024`.`a2`) = `test`.`t2_1024`.`b2`))) select left(a1,7), left(a2,7) @@ -872,9 +872,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_1024 where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`>(<in_optimizer>(`test`.`t1_1024`.`a1`,<exists>(/* select#2 */ select substr(`test`.`t2_1024`.`b1`,1,1024) from `test`.`t2_1024` where `test`.`t2_1024`.`b1` > '0' and <cache>(`test`.`t1_1024`.`a1`) = substr(`test`.`t2_1024`.`b1`,1,1024)))) select left(a1,7), left(a2,7) @@ -886,9 +886,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`>(<in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (/* select#2 */ select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key where `test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)`)))) select left(a1,7), left(a2,7) @@ -903,9 +903,9 @@ set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` where <expr_cache><`test`.`t1_1024`.`a1`>(<in_optimizer>(`test`.`t1_1024`.`a1`,`test`.`t1_1024`.`a1` in ( <materialize> (/* select#2 */ select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2` ), <primary_index_lookup>(`test`.`t1_1024`.`a1` in <temporary table> on distinct_key where `test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)`)))) select left(a1,7), left(a2,7) @@ -945,9 +945,9 @@ insert into t3_1025 values explain extended select left(a1,7), left(a2,7) from t1_1025 where a1 in (select b1 from t2_1025 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`>(<in_optimizer>(`test`.`t1_1025`.`a1`,<exists>(/* select#2 */ select `test`.`t2_1025`.`b1` from `test`.`t2_1025` where `test`.`t2_1025`.`b1` > '0' and <cache>(`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1`))) select left(a1,7), left(a2,7) @@ -959,9 +959,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_1025 where (a1,a2) in (select b1, b2 from t2_1025 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a2`>(<in_optimizer>((`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a2`),<exists>(/* select#2 */ select `test`.`t2_1025`.`b1`,`test`.`t2_1025`.`b2` from `test`.`t2_1025` where `test`.`t2_1025`.`b1` > '0' and <cache>(`test`.`t1_1025`.`a1`) = `test`.`t2_1025`.`b1` and <cache>(`test`.`t1_1025`.`a2`) = `test`.`t2_1025`.`b2`))) select left(a1,7), left(a2,7) @@ -973,9 +973,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_1025 where a1 in (select substring(b1,1,1025) from t2_1025 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`>(<in_optimizer>(`test`.`t1_1025`.`a1`,<exists>(/* select#2 */ select substr(`test`.`t2_1025`.`b1`,1,1025) from `test`.`t2_1025` where `test`.`t2_1025`.`b1` > '0' and <cache>(`test`.`t1_1025`.`a1`) = substr(`test`.`t2_1025`.`b1`,1,1025)))) select left(a1,7), left(a2,7) @@ -987,9 +987,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`>(<in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (/* select#2 */ select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key where `test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)`)))) select left(a1,7), left(a2,7) @@ -1004,9 +1004,9 @@ set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` where <expr_cache><`test`.`t1_1025`.`a1`>(<in_optimizer>(`test`.`t1_1025`.`a1`,`test`.`t1_1025`.`a1` in ( <materialize> (/* select#2 */ select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2` ), <primary_index_lookup>(`test`.`t1_1025`.`a1` in <temporary table> on distinct_key where `test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)`)))) select left(a1,7), left(a2,7) @@ -1029,9 +1029,9 @@ insert into t2bit values (b'110', b'111'); explain extended select bin(a1), bin(a2) from t1bit where (a1, a2) in (select b1, b2 from t2bit); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1bit ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2bit ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1bit NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2bit NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select conv(`test`.`t1bit`.`a1`,10,2) AS `bin(a1)`,conv(`test`.`t1bit`.`a2`,10,2) AS `bin(a2)` from `test`.`t1bit` where <expr_cache><`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`>(<in_optimizer>((`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`),(`test`.`t1bit`.`a1`,`test`.`t1bit`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2bit`.`b1`,`test`.`t2bit`.`b2` from `test`.`t2bit` ), <primary_index_lookup>(`test`.`t1bit`.`a1` in <temporary table> on distinct_key where `test`.`t1bit`.`a1` = `<subquery2>`.`b1` and `test`.`t1bit`.`a2` = `<subquery2>`.`b2`)))) select bin(a1), bin(a2) @@ -1052,9 +1052,9 @@ insert into t2bb values (b'110', '111'); explain extended select bin(a1), a2 from t1bb where (a1, a2) in (select b1, b2 from t2bb); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1bb ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2bb ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1bb NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2bb NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 /* select#1 */ select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` where <expr_cache><`test`.`t1bb`.`a1`,`test`.`t1bb`.`a2`>(<in_optimizer>((`test`.`t1bb`.`a1`,`test`.`t1bb`.`a2`),<exists>(/* select#2 */ select `test`.`t2bb`.`b1`,`test`.`t2bb`.`b2` from `test`.`t2bb` where <cache>(`test`.`t1bb`.`a1`) = `test`.`t2bb`.`b1` and <cache>(`test`.`t1bb`.`a2`) = `test`.`t2bb`.`b2`))) select bin(a1), a2 @@ -1100,9 +1100,9 @@ insert into t3 values (20); insert into t3 values (30); explain extended select a from t1 where a in (select c from t2 where d >= 20); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`c`)))) select a from t1 where a in (select c from t2 where d >= 20); @@ -1114,9 +1114,9 @@ a create index it1a on t1(a); explain extended select a from t1 where a in (select c from t2 where d >= 20); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using where; Using index -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL it1a 4 NULL 7 100.00 Using where; Using index +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`c`)))) select a from t1 where a in (select c from t2 where d >= 20); @@ -1128,9 +1128,9 @@ a insert into t2 values (1,10); explain extended select a from t1 where a in (select c from t2 where d >= 20); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL it1a 4 NULL 7 100.00 Using where; Using index -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL it1a 4 NULL 7 100.00 Using where; Using index +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`c`)))) select a from t1 where a in (select c from t2 where d >= 20); @@ -1141,9 +1141,9 @@ a 3 explain extended select a from t1 group by a having a in (select c from t2 where d >= 20); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 range NULL it1a 4 NULL 8 100.00 Using index for group-by -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range NULL it1a 4 NULL 8 100.00 Using index for group-by +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`c`)))) select a from t1 group by a having a in (select c from t2 where d >= 20); @@ -1153,9 +1153,9 @@ a create index iab on t1(a, b); explain extended select a from t1 group by a having a in (select c from t2 where d >= 20); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 range NULL it1a 4 NULL 8 100.00 Using index for group-by -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range NULL it1a 4 NULL 8 100.00 Using index for group-by +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`c`)))) select a from t1 group by a having a in (select c from t2 where d >= 20); @@ -1165,10 +1165,10 @@ a explain extended select a from t1 group by a having a in (select c from t2 where d >= some(select e from t3 where max(b)=e)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 range NULL iab 4 NULL 8 100.00 Using index for group-by -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 Using where -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range NULL iab 4 NULL 8 100.00 Using index for group-by +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 Note 1981 Aggregate function 'max()' of SELECT #3 belongs to SELECT #1 @@ -1181,10 +1181,10 @@ a explain extended select a from t1 where a in (select c from t2 where d >= some(select e from t3 where b=e)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL iab 8 NULL 7 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 Using where -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL iab 8 NULL 7 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t2`.`c` from `test`.`t2` where <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(/* select#3 */ select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and <cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`)))) and <cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`))) @@ -1212,9 +1212,9 @@ create table t1 (a1 int key); create table t2 (b1 int); insert into t1 values (5); explain select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1); min(a1) NULL @@ -1222,18 +1222,18 @@ set @local_optimizer_switch=@@optimizer_switch; set @@optimizer_switch=@optimizer_switch_local_default; set @@optimizer_switch='materialization=off,in_to_exists=on'; explain select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1); min(a1) NULL set @@optimizer_switch=@optimizer_switch_local_default; set @@optimizer_switch='semijoin=off'; explain select min(a1) from t1 where 7 in (select b1 from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table select min(a1) from t1 where 7 in (select b1 from t2); min(a1) NULL @@ -1241,17 +1241,17 @@ set @@optimizer_switch=@optimizer_switch_local_default; set @@optimizer_switch='materialization=off,in_to_exists=on'; # with MariaDB and MWL#90, this particular case is solved: explain select min(a1) from t1 where 7 in (select b1 from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table select min(a1) from t1 where 7 in (select b1 from t2); min(a1) NULL # but when we go around MWL#90 code, the problem still shows up: explain select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4; min(a1) NULL @@ -1261,9 +1261,9 @@ create table t1 (a char(2), b varchar(10)); insert into t1 values ('a', 'aaa'); insert into t1 values ('aa', 'aaaa'); explain select a,b from t1 where b in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 select a,b from t1 where b in (select a from t1); a b prepare st1 from "select a,b from t1 where b in (select a from t1)"; @@ -1297,11 +1297,11 @@ FROM t3 GROUP BY t3i ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using where +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 Using temporary DROP TABLE t1,t2,t3,t4; CREATE TABLE t1 ( pk INTEGER AUTO_INCREMENT, @@ -1405,10 +1405,10 @@ set optimizer_switch='derived_merge=off,derived_with_keys=off'; explain SELECT a FROM ( SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a > 3 OR t2.b IN (SELECT a FROM t1) ) table1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT a FROM ( SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a > 3 OR t2.b IN (SELECT a FROM t1) ) table1; @@ -1434,10 +1434,10 @@ INSERT INTO t1 VALUES (10,0); INSERT INTO t2 VALUES (10,0),(11,0); explain SELECT * FROM t1 JOIN t2 USING (f1) WHERE t1.f1 IN (SELECT t1.pk FROM t1 ORDER BY t1.f1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t1 NULL system NULL NULL NULL NULL 1 SELECT * FROM t1 JOIN t2 USING (f1) WHERE t1.f1 IN (SELECT t1.pk FROM t1 ORDER BY t1.f1); f1 pk pk @@ -1508,10 +1508,10 @@ set @local_optimizer_switch=@@optimizer_switch; set @@optimizer_switch=@optimizer_switch_local_default; SET @@optimizer_switch='semijoin=on,materialization=on'; EXPLAIN SELECT COUNT(*) FROM t1 WHERE (f1,f2) IN (SELECT f1,f2 FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 7 func,func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 7 func,func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(*) FROM t1 WHERE (f1,f2) IN (SELECT f1,f2 FROM t2); COUNT(*) 2 @@ -1532,10 +1532,10 @@ set @local_optimizer_switch=@@optimizer_switch; set @@optimizer_switch=@optimizer_switch_local_default; SET @@optimizer_switch='semijoin=on,materialization=on'; EXPLAIN SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Rowid-ordered scan SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0); pk 2 @@ -1574,9 +1574,9 @@ insert into t0 values (0),(1),(2); create table t1 (a int); insert into t1 values (0),(1),(2); explain select a, a in (select a from t1) from t0; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 3 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 3 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 select a, a in (select a from t1) from t0; a a in (select a from t1) 0 1 @@ -1621,9 +1621,9 @@ insert into t2_1024 values insert into t2_1024 values (concat('1 - 03', repeat('x', @suffix_len)), concat('2 - 03', repeat('x', @suffix_len))); explain select left(a1,7), left(a2,7) from t1_1024 where (a1,3) in (select substring(b1,1,1024), count(*) from t2_1024 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 Using where -2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_1024 NULL ALL NULL NULL NULL NULL 3 Using where +2 DEPENDENT SUBQUERY t2_1024 NULL ALL NULL NULL NULL NULL 3 Using where select left(a1,7), left(a2,7) from t1_1024 where (a1,3) in (select substring(b1,1,1024), count(*) from t2_1024 where b1 > '0'); left(a1,7) left(a2,7) 1 - 01x 2 - 01x @@ -1852,9 +1852,9 @@ INSERT INTO t1 VALUES (8); EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN ( SELECT MIN(a) FROM t1 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 /* select#1 */ select 8 AS `a` from dual where <expr_cache><8>(<in_optimizer>(8,<exists>(/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` having <cache>(8) = <ref_null_helper>(min(`test`.`t1`.`a`))))) DROP TABLE t1; @@ -1887,10 +1887,10 @@ SELECT alias3.c FROM t2 AS alias3, t2 AS alias4 WHERE alias4.c = alias3.b ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -3 MATERIALIZED alias3 ALL NULL NULL NULL NULL 2 Using where -3 MATERIALIZED alias4 ref c c 11 test.alias3.b 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 MATERIALIZED alias3 NULL ALL NULL NULL NULL NULL 2 Using where +3 MATERIALIZED alias4 NULL ref c c 11 test.alias3.b 2 Using where; Using index DROP TABLE t1,t2; # # BUG#928048: Query containing IN subquery with OR in the where clause returns a wrong result @@ -1901,9 +1901,9 @@ create table t2 (a int, b int, index i_a(a)); insert into t2 values (4,2), (7,9), (7,4), (3,1), (5,3), (3,1), (9,4), (8,1); explain select * from t1 where t1.a in (select a from t2 where t2.a=7 or t2.b<=1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 MATERIALIZED t2 ALL i_a NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 MATERIALIZED t2 NULL ALL i_a NULL NULL NULL 8 Using where select * from t1 where t1.a in (select a from t2 where t2.a=7 or t2.b<=1); a b 7 5 @@ -1931,9 +1931,9 @@ CREATE TABLE t2(a int); INSERT INTO t2 values(1),(2); # Should use Materialization: EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using temporary flush status; CREATE TABLE t3 SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1); SHOW STATUS LIKE 'Created_tmp_tables'; @@ -1952,10 +1952,10 @@ INSERT INTO t2 VALUES (4), (7), (6); EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (SELECT MAX(c) FROM t2) AND b=7 AND (a IS NULL OR a=b); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL const distinct_key distinct_key 4 const 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (/* select#2 */ select max(`test`.`t2`.`c`) from `test`.`t2` having `MAX(c)` is null or `MAX(c)` = 7) join `test`.`t1` where `test`.`t1`.`b` = 7 and `test`.`t1`.`a` = `<subquery2>`.`MAX(c)` and (<cache>(/*always not null*/ 1 is null) or `<subquery2>`.`MAX(c)` = 7) SELECT * FROM t1 @@ -1965,10 +1965,10 @@ a b EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT MAX(c) FROM t2 WHERE c < 4) AND b=7 AND (a IS NULL OR a=b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL const distinct_key distinct_key 4 const 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * FROM t1 WHERE a IN (SELECT MAX(c) FROM t2 WHERE c < 4) AND b=7 AND (a IS NULL OR a=b); a b @@ -1989,12 +1989,12 @@ EXPLAIN SELECT a, c FROM t1, t2 WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2 WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 index NULL c 5 NULL 8 Using where; Using index -2 MATERIALIZED s2 ref d d 4 const 2 Using where; Using index -2 MATERIALIZED s1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t2 ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL index NULL c 5 NULL 8 Using where; Using index +2 MATERIALIZED s2 NULL ref d d 4 const 2 Using where; Using index +2 MATERIALIZED s1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 SELECT a, c FROM t1, t2 WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2 WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2)); @@ -2008,12 +2008,12 @@ EXPLAIN SELECT a, c FROM t1, t2 WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2 WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 index NULL c 5 NULL 8 Using where; Using index -2 MATERIALIZED s2 ref d d 4 const 2 Using where; Using index -2 MATERIALIZED s1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t2 ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL index NULL c 5 NULL 8 Using where; Using index +2 MATERIALIZED s2 NULL ref d d 4 const 2 Using where; Using index +2 MATERIALIZED s1 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 SELECT a, c FROM t1, t2 WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2 WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2)); @@ -2193,10 +2193,10 @@ mysqltest2 mysqltest1 EXPLAIN EXTENDED SELECT db FROM t1 WHERE db IN (SELECT SCHEMA_NAME FROM information_schema.schemata) ORDER BY db DESC; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2 100.00 Using temporary; Using filesort -1 PRIMARY t1 eq_ref db db 764 information_schema.schemata.SCHEMA_NAME 1 100.00 Using where; Using index -2 MATERIALIZED schemata ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 100.00 Using temporary; Using filesort +1 PRIMARY t1 NULL eq_ref db db 764 information_schema.schemata.SCHEMA_NAME 1 100.00 Using where; Using index +2 MATERIALIZED schemata NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 select `test`.`t1`.`db` AS `db` from `test`.`t1` semi join (`information_schema`.`schemata`) where `test`.`t1`.`db` = `information_schema`.`schemata`.`SCHEMA_NAME` order by `test`.`t1`.`db` desc drop table t1; @@ -2239,11 +2239,11 @@ EXPLAIN SELECT sq1.f2 FROM t1 AS sq1 WHERE EXISTS ( SELECT * FROM t1 AS sq2 WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY sq1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -2 DEPENDENT SUBQUERY sq2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY sq1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +2 DEPENDENT SUBQUERY sq2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 # this checks the result set above set optimizer_switch= 'materialization=off,semijoin=off'; SELECT sq1.f2 FROM t1 AS sq1 @@ -2273,12 +2273,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t2, t3 WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 DEPENDENT SUBQUERY t2 range i2 i2 5 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t3 ref i3 i3 5 test.t2.i2 2 100.00 Using index -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 8 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 DEPENDENT SUBQUERY t2 NULL range i2 i2 5 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t3 NULL ref i3 i3 5 test.t2.i2 2 100.00 Using index +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 8 100.00 Warnings: Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`>(exists(/* select#2 */ select 1 from `test`.`t2` semi join (`test`.`t3`) join `test`.`t3` where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t1`.`f1` = `test`.`t3`.`f3` limit 1)) @@ -2312,11 +2312,11 @@ pk f1 sq EXPLAIN EXTENDED SELECT pk, f1, ( SELECT COUNT(*) FROM t2 WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 -2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 +2 DEPENDENT SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`f1` AS `f1`,<expr_cache><`test`.`t1`.`pk`>((/* select#2 */ select count(0) from `test`.`t2` semi join (`test`.`t2`) where `test`.`t1`.`pk` = `test`.`t2`.`f2`)) AS `sq` from `test`.`t1` @@ -2368,11 +2368,11 @@ FROM t2, t3 t3_i WHERE t2.ugroup = t3_i.sys_id AND t3_i.type LIKE '59e22fb137032000158bbfc8bcbe5d52' AND t2.user = '86826bf03710200044e0bfc8bcbe5d79'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ref idx3,idx4 idx4 35 const 2 Using index condition; Using where; Start temporary -1 PRIMARY t3_i eq_ref PRIMARY PRIMARY 32 test.t2.ugroup 1 Using index condition; Using where -1 PRIMARY t1 ref idx1,idx2 idx1 35 test.t3_i.sys_id 2 Using index condition; Using where; End temporary -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 32 test.t1.assignment_group 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ref idx3,idx4 idx4 35 const 2 Using index condition; Using where; Start temporary +1 PRIMARY t3_i NULL eq_ref PRIMARY PRIMARY 32 test.t2.ugroup 1 Using index condition; Using where +1 PRIMARY t1 NULL ref idx1,idx2 idx1 35 test.t3_i.sys_id 2 Using index condition; Using where; End temporary +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 32 test.t1.assignment_group 1 Using where; Using index SELECT t1.assignment_group FROM t1, t3 WHERE t1.assignment_group = t3.sys_id AND @@ -2398,12 +2398,12 @@ FROM t2, t3 t3_i WHERE t2.ugroup = t3_i.sys_id AND t3_i.type LIKE '59e22fb137032000158bbfc8bcbe5d52' AND t2.user = '86826bf03710200044e0bfc8bcbe5d79'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t1 ref idx1,idx2 idx1 35 test.t2.ugroup 2 Using where -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 32 test.t1.assignment_group 1 Using where; Using index -2 MATERIALIZED t2 ref idx3,idx4 idx4 35 const 2 Using index condition; Using where -2 MATERIALIZED t3_i eq_ref PRIMARY PRIMARY 32 test.t2.ugroup 1 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 +1 PRIMARY t1 NULL ref idx1,idx2 idx1 35 test.t2.ugroup 2 Using where +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 32 test.t1.assignment_group 1 Using where; Using index +2 MATERIALIZED t2 NULL ref idx3,idx4 idx4 35 const 2 Using index condition; Using where +2 MATERIALIZED t3_i NULL eq_ref PRIMARY PRIMARY 32 test.t2.ugroup 1 Using index condition; Using where SELECT t1.assignment_group FROM t1, t3 WHERE t1.assignment_group = t3.sys_id AND @@ -2433,10 +2433,10 @@ CREATE TABLE t2 (i1 int NOT NULL, i2 int NOT NULL) ; INSERT INTO t2 VALUES (11,11),(12,12),(13,13); explain SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 9 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2); 1 1 @@ -2446,10 +2446,10 @@ set @@join_cache_level= @save_join_cache_level; alter table t1 add key(id); explain SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index id id 4 NULL 9 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index id id 4 NULL 9 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2); 1 1 @@ -2503,10 +2503,10 @@ CREATE TABLE t2 (i1 int NOT NULL, i2 int NOT NULL); INSERT INTO t2 VALUES (11,11),(12,12),(13,13); CREATE VIEW v1 AS SELECT t2.i1 FROM t2 where t2.i1 = t2.i2; explain SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index id id 4 NULL 9 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index id id 4 NULL 9 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1); 1 1 @@ -2554,11 +2554,11 @@ id a b id a explain extended select * from t1 left join t4 on t1.b = t4.id where f1(t1.id, '1980-01-01') in (select id from t2 where x=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 Using where -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t4`.`id` AS `id`,`test`.`t4`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) left join `test`.`t4` on(`test`.`t4`.`id` = `test`.`t1`.`b`) where `test`.`t2`.`x` = 1 and `f1`(`test`.`t1`.`id`,'1980-01-01') = `test`.`t2`.`id` # Non-deterministic function in left part of IN subq: semi-join is OK @@ -2572,11 +2572,11 @@ id a b id a explain extended select * from t1 left join t4 on t1.b = t4.id where f2(t1.id, '1980-01-01') in (select id from t2 where x=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 Using where -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t4`.`id` AS `id`,`test`.`t4`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) left join `test`.`t4` on(`test`.`t4`.`id` = `test`.`t1`.`b`) where `test`.`t2`.`x` = 1 and `f2`(`test`.`t1`.`id`,'1980-01-01') = `test`.`t2`.`id` select t1.*, t4.*, @@ -2591,12 +2591,12 @@ explain extended select t1.*, t4.*, (select max(t4.id) from t4 where t4.id=t1.b and sleep(0) = 0) as s from t1 left join t4 on t1.b = t4.id where f2(t1.id, '1980-01-01') in (select id from t2 where x=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 Using where -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t4`.`id` AS `id`,`test`.`t4`.`a` AS `a`,(/* select#2 */ select max(`test`.`t4`.`id`) from `test`.`t4` where `test`.`t4`.`id` = `test`.`t1`.`b` and sleep(0) = 0) AS `s` from `test`.`t1` semi join (`test`.`t2`) left join `test`.`t4` on(`test`.`t4`.`id` = `test`.`t1`.`b`) where `test`.`t2`.`x` = 1 and `f2`(`test`.`t1`.`id`,'1980-01-01') = `test`.`t2`.`id` @@ -2621,10 +2621,10 @@ create table t3 as select * from t2 limit 1; # The testcase only makes sense if the following uses Materialization: explain select * from t1 where (a,b) in (select max(a),b from t2 group by b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 1000 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4000 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 1000 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4000 Using temporary flush status; replace into t3 select * from t1 where (a,b) in (select max(a),b from t2 group by b); @@ -2695,9 +2695,9 @@ insert into t0 values (0),(1),(2); create table t1 (a int); insert into t1 values (0),(1),(2); explain select a, a in (select a from t1) from t0; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 3 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 3 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 select a, a in (select a from t1) from t0; a a in (select a from t1) 0 1 @@ -2727,17 +2727,17 @@ insert into t2 values (2); set @@optimizer_switch='semijoin=off'; EXPLAIN SELECT SUM(c1) c1_sum FROM t1 WHERE c1 IN (SELECT c2 FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL system NULL NULL NULL NULL 1 SELECT SUM(c1) c1_sum FROM t1 WHERE c1 IN (SELECT c2 FROM t2); c1_sum NULL EXPLAIN SELECT SUM(c1) c1_sum FROM t1 WHERE c1 IN (SELECT c2 FROM t2) HAVING c1_sum; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL system NULL NULL NULL NULL 1 SELECT SUM(c1) c1_sum FROM t1 WHERE c1 IN (SELECT c2 FROM t2) HAVING c1_sum; c1_sum drop table t1, t2; @@ -2753,19 +2753,19 @@ INSERT INTO t2 VALUES (5); CREATE TABLE t3 (k INTEGER); EXPLAIN SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT k FROM t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where -2 MATERIALIZED t3 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where +2 MATERIALIZED t3 NULL system NULL NULL NULL NULL 0 Const row not found SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT k FROM t3); i 10 EXPLAIN SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT max(k) FROM t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where -2 MATERIALIZED t3 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where +2 MATERIALIZED t3 NULL system NULL NULL NULL NULL 0 Const row not found SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT max(k) FROM t3); i 10 @@ -2804,10 +2804,10 @@ CREATE TABLE t2 LIKE t1; INSERT INTO t2 VALUES (1,'i','iiii','iiii','iiii'),(2,'f','ffff','ffff','ffff'); SET @@optimizer_switch='default,semijoin=on,materialization=on'; EXPLAIN SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0); pk 2 @@ -2850,35 +2850,35 @@ CREATE TABLE t3 (f3a int, f3b int); set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off'; EXPLAIN SELECT * FROM t2 WHERE (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t2 WHERE (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1); f2 EXPLAIN SELECT (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1); (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1) NULL EXPLAIN SELECT * FROM t2 WHERE (SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM t2 WHERE (SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1); f2 EXPLAIN SELECT (SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT (SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1); (SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1) NULL @@ -2896,9 +2896,9 @@ EXPLAIN SELECT (f1, f2, f3) NOT IN (SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3) FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 Using filesort SELECT (f1, f2, f3) NOT IN (SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3) FROM t2; @@ -2919,9 +2919,9 @@ max_res NULL EXPLAIN EXTENDED SELECT MAX(t1.b) AS max_res FROM t1 WHERE (9) IN (SELECT a FROM t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 /* select#1 */ select max(`test`.`t1`.`b`) AS `max_res` from `test`.`t1` where 0 set @@optimizer_switch='materialization=off,in_to_exists=on,semijoin=off'; @@ -2930,9 +2930,9 @@ max_res NULL EXPLAIN EXTENDED SELECT MAX(t1.b) AS max_res FROM t1 WHERE (9) IN (SELECT a FROM t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 /* select#1 */ select max(`test`.`t1`.`b`) AS `max_res` from `test`.`t1` where 0 DROP TABLE t1,t2; @@ -2947,9 +2947,9 @@ set @@optimizer_switch='semijoin=off,in_to_exists=off,materialization=on,partial EXPLAIN SELECT * FROM t1 WHERE (a, b) NOT IN (SELECT a, b FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE (a, b) NOT IN (SELECT a, b FROM t2); @@ -2959,9 +2959,9 @@ a b EXPLAIN SELECT a, b, (a, b) NOT IN (SELECT a, b FROM t2) as sq FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT a, b, (a, b) NOT IN (SELECT a, b FROM t2) as sq FROM t1; a b sq @@ -2977,9 +2977,9 @@ CREATE TABLE t2 (f CHAR(1)); INSERT INTO t2 VALUES ('a'),('b'); explain SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 ); f DROP TABLE t1, t2; @@ -2991,10 +2991,10 @@ create table t2 (v1 varchar(1)) engine=myisam ; explain select 1 from t1 where exists (select 1 from t1 where t1.v1 in (select t2.v1 from t2 having t2.v1 < 'j')) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table select 1 from t1 where exists (select 1 from t1 where t1.v1 in (select t2.v1 from t2 having t2.v1 < 'j')) ; 1 diff --git a/mysql-test/main/subselect_mat_cost.result b/mysql-test/main/subselect_mat_cost.result index 66d48b549c4..fb6d9698326 100644 --- a/mysql-test/main/subselect_mat_cost.result +++ b/mysql-test/main/subselect_mat_cost.result @@ -64,9 +64,9 @@ SELECT Name FROM Country WHERE (Code IN (select Country from City where City.Population > 100000) OR Name LIKE 'L%') AND surfacearea > 1000000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country ALL Name,SurfaceArea NULL NULL NULL 239 Using where -2 MATERIALIZED City ALL Population,Country NULL NULL NULL 4079 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL ALL Name,SurfaceArea NULL NULL NULL 239 Using where +2 MATERIALIZED City NULL ALL Population,Country NULL NULL NULL 4079 Using where SELECT Name FROM Country WHERE (Code IN (select Country from City where City.Population > 100000) OR Name LIKE 'L%') AND @@ -110,9 +110,9 @@ SELECT Name FROM Country WHERE (Code IN (select Country from City where City.Population > 100000) OR Name LIKE 'L%') AND surfacearea > 10*1000000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country range Name,SurfaceArea SurfaceArea 4 NULL 5 Using index condition; Using where; Rowid-ordered scan -2 DEPENDENT SUBQUERY City index_subquery Population,Country Country 3 func 17 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL range Name,SurfaceArea SurfaceArea 4 NULL 5 Using index condition; Using where; Rowid-ordered scan +2 DEPENDENT SUBQUERY City NULL index_subquery Population,Country Country 3 func 17 Using where SELECT Name FROM Country WHERE (Code IN (select Country from City where City.Population > 100000) OR Name LIKE 'L%') AND @@ -132,10 +132,10 @@ Country.SurfaceArea < 3000 AND Country.SurfaceArea > 10 AND (City.Name IN (select Language from CountryLanguage where Percentage > 50) OR City.name LIKE '%Island%'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country ALL PRIMARY,SurfaceArea NULL NULL NULL 239 Using where -1 PRIMARY City ref Country Country 3 world.Country.Code 17 Using where -2 MATERIALIZED CountryLanguage ALL Percentage,Language NULL NULL NULL 984 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL ALL PRIMARY,SurfaceArea NULL NULL NULL 239 Using where +1 PRIMARY City NULL ref Country Country 3 world.Country.Code 17 Using where +2 MATERIALIZED CountryLanguage NULL ALL Percentage,Language NULL NULL NULL 984 Using where SELECT * FROM Country, City WHERE City.Country = Country.Code AND @@ -157,10 +157,10 @@ Country.SurfaceArea < 3000 AND Country.SurfaceArea > 10 AND (Country.Name IN (select Language from CountryLanguage where Percentage > 50) OR Country.name LIKE '%Island%'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country ALL PRIMARY,SurfaceArea NULL NULL NULL 239 Using where -1 PRIMARY City ref Country Country 3 world.Country.Code 17 -2 DEPENDENT SUBQUERY CountryLanguage index_subquery Percentage,Language Language 30 func 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL ALL PRIMARY,SurfaceArea NULL NULL NULL 239 Using where +1 PRIMARY City NULL ref Country Country 3 world.Country.Code 17 +2 DEPENDENT SUBQUERY CountryLanguage NULL index_subquery Percentage,Language Language 30 func 2 Using where SELECT * FROM Country, City WHERE City.Country = Country.Code AND @@ -202,11 +202,11 @@ Country.Population > 3000000 OR (Country.Code, City.Name) IN (select Country, Language from CountryLanguage)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country ALL PRIMARY,SurfaceArea NULL NULL NULL 239 Using where -1 PRIMARY City ref Country Country 3 world.Country.Code 17 Using where -3 MATERIALIZED CountryLanguage index PRIMARY,Language PRIMARY 33 NULL 984 Using index -2 DEPENDENT SUBQUERY CountryLanguage unique_subquery PRIMARY,Percentage,Language PRIMARY 33 func,func 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL ALL PRIMARY,SurfaceArea NULL NULL NULL 239 Using where +1 PRIMARY City NULL ref Country Country 3 world.Country.Code 17 Using where +3 MATERIALIZED CountryLanguage NULL index PRIMARY,Language PRIMARY 33 NULL 984 Using index +2 DEPENDENT SUBQUERY CountryLanguage NULL unique_subquery PRIMARY,Percentage,Language PRIMARY 33 func,func 1 Using where SELECT City.Name, Country.Name FROM City,Country WHERE City.Country = Country.Code AND @@ -232,9 +232,9 @@ EXPLAIN select count(*) from City where City.id not in (select capital from Country where capital is not null and population < 100000); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY City index NULL PRIMARY 4 NULL 4079 Using where; Using index -2 MATERIALIZED Country ALL NULL NULL NULL NULL 239 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY City NULL index NULL PRIMARY 4 NULL 4079 Using where; Using index +2 MATERIALIZED Country NULL ALL NULL NULL NULL NULL 239 Using where Q2.2e: Countries that speak French, but do not speak English @@ -246,10 +246,10 @@ FROM Country, CountryLanguage WHERE Code NOT IN (SELECT Country FROM CountryLanguage WHERE Language = 'English') AND CountryLanguage.Language = 'French' AND Code = Country; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY CountryLanguage ref PRIMARY,Language Language 30 const 19 Using index condition -1 PRIMARY Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where -2 DEPENDENT SUBQUERY CountryLanguage unique_subquery PRIMARY,Language PRIMARY 33 func,const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY CountryLanguage NULL ref PRIMARY,Language Language 30 const 19 Using index condition +1 PRIMARY Country NULL eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where +2 DEPENDENT SUBQUERY CountryLanguage NULL unique_subquery PRIMARY,Language PRIMARY 33 func,const 1 Using index; Using where SELECT Country.Name FROM Country, CountryLanguage WHERE Code NOT IN (SELECT Country FROM CountryLanguage WHERE Language = 'English') @@ -286,10 +286,10 @@ FROM Country, CountryLanguage WHERE Code NOT IN (SELECT Country FROM CountryLanguage WHERE Language = 'English') AND (CountryLanguage.Language = 'French' OR CountryLanguage.Language = 'Spanish') AND Code = Country; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY CountryLanguage range PRIMARY,Language Language 30 NULL 44 Using index condition; Rowid-ordered scan -1 PRIMARY Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where -3 DEPENDENT SUBQUERY CountryLanguage unique_subquery PRIMARY,Language PRIMARY 33 func,const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY CountryLanguage NULL range PRIMARY,Language Language 30 NULL 44 Using index condition; Rowid-ordered scan +1 PRIMARY Country NULL eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where +3 DEPENDENT SUBQUERY CountryLanguage NULL unique_subquery PRIMARY,Language PRIMARY 33 func,const 1 Using index; Using where set statement optimizer_switch='rowid_filter=off' for SELECT Country.Name FROM Country, CountryLanguage @@ -349,10 +349,10 @@ where (Language, Country) NOT IN (SELECT City.Name, Country.Code FROM City LEFT JOIN Country ON (Country = Code and City.Population < 10000)) AND Language IN ('English','Spanish'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY CountryLanguage range Language Language 30 NULL 73 Using index condition; Using where; Rowid-ordered scan -2 DEPENDENT SUBQUERY City ref CityName CityName 35 func 1 Using index condition -2 DEPENDENT SUBQUERY Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY CountryLanguage NULL range Language Language 30 NULL 73 Using index condition; Using where; Rowid-ordered scan +2 DEPENDENT SUBQUERY City NULL ref CityName CityName 35 func 1 Using index condition +2 DEPENDENT SUBQUERY Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using index select count(*) from CountryLanguage where (Language, Country) NOT IN @@ -372,10 +372,10 @@ where (Language, Country) NOT IN (SELECT City.Name, Country.Code FROM City LEFT JOIN Country ON (Country = Code) HAVING City.Name LIKE "Santa%"); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY CountryLanguage index NULL PRIMARY 33 NULL 984 Using where; Using index -2 MATERIALIZED City ALL NULL NULL NULL NULL 4079 -2 MATERIALIZED Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY CountryLanguage NULL index NULL PRIMARY 33 NULL 984 Using where; Using index +2 MATERIALIZED City NULL ALL NULL NULL NULL NULL 4079 +2 MATERIALIZED Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using index select count(*) from CountryLanguage where (Language, Country) NOT IN @@ -400,12 +400,12 @@ OR (Country, 11) IN (SELECT Code, COUNT(*) FROM CountryLanguage, Country WHERE Code = Country GROUP BY Code) order by Country; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY CountryLanguage index NULL PRIMARY 33 NULL 984 Using where; Using index -3 MATERIALIZED Country index PRIMARY PRIMARY 3 NULL 239 Using index -3 MATERIALIZED CountryLanguage ref PRIMARY PRIMARY 3 world.Country.Code 4 Using index -2 MATERIALIZED Country index PRIMARY PRIMARY 3 NULL 239 Using index -2 MATERIALIZED CountryLanguage ref PRIMARY PRIMARY 3 world.Country.Code 4 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY CountryLanguage NULL index NULL PRIMARY 33 NULL 984 Using where; Using index +3 MATERIALIZED Country NULL index PRIMARY PRIMARY 3 NULL 239 Using index +3 MATERIALIZED CountryLanguage NULL ref PRIMARY PRIMARY 3 world.Country.Code 4 Using index +2 MATERIALIZED Country NULL index PRIMARY PRIMARY 3 NULL 239 Using index +2 MATERIALIZED CountryLanguage NULL ref PRIMARY PRIMARY 3 world.Country.Code 4 Using index select count(*) from CountryLanguage where @@ -429,10 +429,10 @@ where capital = id and (City.name in (SELECT name FROM City GROUP BY name HAVING Count(*) > 2) OR capital is null); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country ALL NULL NULL NULL NULL 239 Using where -1 PRIMARY City eq_ref PRIMARY PRIMARY 4 world.Country.Capital 1 Using where -2 MATERIALIZED City index NULL CityName 35 NULL 4079 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL ALL NULL NULL NULL NULL 239 Using where +1 PRIMARY City NULL eq_ref PRIMARY PRIMARY 4 world.Country.Capital 1 Using where +2 MATERIALIZED City NULL index NULL CityName 35 NULL 4079 Using index select * from Country, City where capital = id and (City.name in (SELECT name FROM City @@ -451,9 +451,9 @@ SELECT Name FROM Country WHERE Country.Code NOT IN (SELECT Country FROM City GROUP BY Name HAVING COUNT(Name) = 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country ALL NULL NULL NULL NULL 239 Using where -2 MATERIALIZED City ALL NULL NULL NULL NULL 4079 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL ALL NULL NULL NULL NULL 239 Using where +2 MATERIALIZED City NULL ALL NULL NULL NULL NULL 4079 Using temporary SELECT Name FROM Country WHERE Country.Code NOT IN @@ -481,9 +481,9 @@ EXPLAIN select Name, City.id in (select capital from Country where capital is not null) as is_capital from City where City.population > 10000000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY City range Population Population 5 NULL 3 Using index condition; Rowid-ordered scan -2 MATERIALIZED Country ALL NULL NULL NULL NULL 239 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY City NULL range Population Population 5 NULL 3 Using index condition; Rowid-ordered scan +2 MATERIALIZED Country NULL ALL NULL NULL NULL NULL 239 Using where select Name, City.id in (select capital from Country where capital is not null) as is_capital from City where City.population > 10000000; @@ -497,9 +497,9 @@ EXPLAIN select Name, City.id in (select capital from Country where capital is not null) as is_capital from City where City.population > 10000000; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY City range Population Population 5 NULL 3 Using index condition; Rowid-ordered scan -2 SUBQUERY Country index_subquery CountryCapital CountryCapital 5 func 2 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY City NULL range Population Population 5 NULL 3 Using index condition; Rowid-ordered scan +2 SUBQUERY Country NULL index_subquery CountryCapital CountryCapital 5 func 2 Using index; Using where select Name, City.id in (select capital from Country where capital is not null) as is_capital from City where City.population > 10000000; @@ -514,10 +514,10 @@ SELECT City.Name, City.Population FROM City JOIN Country ON City.Country = Country.Code GROUP BY City.Name HAVING City.Name IN (select Name from Country where population < 1000000); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY Country index PRIMARY PRIMARY 3 NULL 239 Using index; Using temporary; Using filesort -1 PRIMARY City ref Country Country 3 world.Country.Code 17 -2 MATERIALIZED Country ALL Name NULL NULL NULL 239 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY Country NULL index PRIMARY PRIMARY 3 NULL 239 Using index; Using temporary; Using filesort +1 PRIMARY City NULL ref Country Country 3 world.Country.Code 17 +2 MATERIALIZED Country NULL ALL Name NULL NULL NULL 239 Using where SELECT City.Name, City.Population FROM City JOIN Country ON City.Country = Country.Code GROUP BY City.Name @@ -540,11 +540,11 @@ UNION SELECT Name, round(Population/1000) FROM City WHERE Country = "IND" AND Population < 100000); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY City ALL NULL NULL NULL NULL 4079 Using where -2 DEPENDENT SUBQUERY City ref Population,Country,CityName CityName 35 func 1 Using where -3 DEPENDENT UNION City ref Population,Country,CityName CityName 35 func 1 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY City NULL ALL NULL NULL NULL NULL 4079 Using where +2 DEPENDENT SUBQUERY City NULL ref Population,Country,CityName CityName 35 func 1 Using where +3 DEPENDENT UNION City NULL ref Population,Country,CityName CityName 35 func 1 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT * from City where (Name, 91) in (SELECT Name, round(Population/1000) FROM City diff --git a/mysql-test/main/subselect_mat_cost_bugs.result b/mysql-test/main/subselect_mat_cost_bugs.result index 6a218ed5e04..41e5dff9b49 100644 --- a/mysql-test/main/subselect_mat_cost_bugs.result +++ b/mysql-test/main/subselect_mat_cost_bugs.result @@ -93,11 +93,11 @@ WHERE c1 IN FROM (t1b JOIN t2 ON t2.c3 = t1b.c4) LEFT JOIN t1a ON (t1a.c2 = t1b.pk AND 2) WHERE t1.pk) ; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 9 100.00 Using where -2 DEPENDENT SUBQUERY t1b ALL NULL NULL NULL NULL 9 100.00 -2 DEPENDENT SUBQUERY t1a ref c2 c2 5 test.t1b.pk 1 100.00 Using where -2 DEPENDENT SUBQUERY t2 index c3 c3 9 NULL 2 100.00 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +2 DEPENDENT SUBQUERY t1b NULL ALL NULL NULL NULL NULL 9 100.00 +2 DEPENDENT SUBQUERY t1a NULL ref c2 c2 5 test.t1b.pk 1 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL index c3 c3 9 NULL 2 100.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where <expr_cache><`test`.`t1`.`c1`,`test`.`t1`.`pk`>(<in_optimizer>(`test`.`t1`.`c1`,<exists>(/* select#2 */ select `test`.`t1a`.`c1` from `test`.`t1b` join `test`.`t2` left join `test`.`t1a` on(`test`.`t1a`.`c2` = `test`.`t1b`.`pk` and 2) where `test`.`t1`.`pk` <> 0 and <cache>(`test`.`t1`.`c1`) = `test`.`t1a`.`c1` and `test`.`t2`.`c3` = `test`.`t1b`.`c4`))) @@ -122,9 +122,9 @@ EXPLAIN SELECT t1.* FROM t3 RIGHT JOIN t1 ON t1.pk = t3.f1 WHERE t3.f3 OR ( 3 ) IN ( SELECT f2 FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT t1.* FROM t3 RIGHT JOIN t1 ON t1.pk = t3.f1 WHERE t3.f3 OR ( 3 ) IN ( SELECT f2 FROM t2 ); @@ -145,10 +145,10 @@ SELECT max(f1) FROM t2 GROUP BY f1 ) ) IS NULL ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 system NULL NULL NULL NULL 1 -3 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL system NULL NULL NULL NULL 1 +3 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using temporary drop table t1, t2, t3; # # LP BUG#715034 Item_sum_distinct::clear(): Assertion `tree != 0' failed @@ -161,18 +161,18 @@ set optimizer_switch='derived_merge=off,derived_with_keys=off'; EXPLAIN SELECT * FROM (SELECT * FROM t2) AS a2 WHERE (SELECT distinct SUM(distinct f3 ) FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found -3 SUBQUERY t1 index NULL f3 5 NULL 2 Using index -2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 0 Const row not found +3 SUBQUERY t1 NULL index NULL f3 5 NULL 2 Using index +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table insert into t2 values (1),(2); EXPLAIN SELECT * FROM (SELECT * FROM t2) AS a2 WHERE (SELECT distinct SUM(distinct f3 ) FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -3 SUBQUERY t1 index NULL f3 5 NULL 2 Using index -2 DERIVED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +3 SUBQUERY t1 NULL index NULL f3 5 NULL 2 Using index +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 set optimizer_switch=@tmp_optimizer_switch; drop table t1,t2; # @@ -193,12 +193,12 @@ FROM t2 JOIN t1 ON (t1.f1>0 or t1.f1<0) WHERE (t1.f1>0 or t1.f1<0) AND alias2.f10 ) ORDER BY field1 ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where; Using filesort -1 PRIMARY alias1 eq_ref PRIMARY PRIMARY 4 alias2.f3 1 Using index -3 DEPENDENT SUBQUERY t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index -3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 DERIVED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 Using where; Using filesort +1 PRIMARY alias1 NULL eq_ref PRIMARY PRIMARY 4 alias2.f3 1 Using index +3 DEPENDENT SUBQUERY t1 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Using index +3 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 SELECT alias2.f2 AS field1 FROM t1 AS alias1 JOIN ( SELECT * FROM t2 ) AS alias2 ON alias2.f3 = alias1.f1 WHERE ( @@ -261,10 +261,10 @@ SELECT alias2.f3 FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f10 = alias1.f11 WHERE alias1.f11 OR alias1.f3 = 50 AND alias1.f10 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED alias1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED alias2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED alias1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED alias2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) SELECT * FROM t2 WHERE ( f12 ) IN ( SELECT alias2.f3 @@ -281,10 +281,10 @@ WHERE ( f12 ) IN ( SELECT alias2.f3 FROM t1 AS alias1, t1 AS alias2 WHERE (alias2.f10 = alias1.f11) AND (alias1.f11 OR alias1.f3 = 50 AND alias1.f10)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED alias1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED alias2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED alias1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED alias2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) SELECT * FROM t2 WHERE ( f12 ) IN ( SELECT alias2.f3 @@ -314,9 +314,9 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain select c1 from t1 where c1 in (select kp1 from t2 where kp2 = 10 and c2 = 4) or c1 > 7; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -2 DEPENDENT SUBQUERY t2 ref key1,key2,key3 key3 5 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +2 DEPENDENT SUBQUERY t2 NULL ref key1,key2,key3 key3 5 const 1 Using where select c1 from t1 where c1 in (select kp1 from t2 where kp2 = 10 and c2 = 4) or c1 > 7; c1 set @@optimizer_switch='default'; @@ -334,9 +334,9 @@ EXPLAIN SELECT * FROM t1 WHERE (f1) IN (SELECT f1 FROM t2) LIMIT 0; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Zero limit -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Zero limit +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE (f1) IN (SELECT f1 FROM t2) LIMIT 0; @@ -361,10 +361,10 @@ SELECT c FROM t4 WHERE t4.a >= t3.b AND a = SOME (SELECT b FROM t5)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t5 index c c 10 NULL 2 Using where; Using index; Start temporary -2 DEPENDENT SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 test.t5.b 1 Using index condition; Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t5 NULL index c c 10 NULL 2 Using where; Using index; Start temporary +2 DEPENDENT SUBQUERY t4 NULL eq_ref PRIMARY PRIMARY 4 test.t5.b 1 Using index condition; Using where; End temporary SELECT * FROM t3 WHERE t3.b > ALL ( @@ -389,16 +389,16 @@ insert into t2 values ('x1', 'y1'); insert into t2 values ('a2', null); set @@optimizer_switch='in_to_exists=off,materialization=on,partial_match_rowid_merge=off,partial_match_table_scan=on'; explain select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2); c1 c2 set @@optimizer_switch='in_to_exists=off,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off'; explain select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2); c1 c2 drop table t1, t2; @@ -420,10 +420,10 @@ SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 ); 1 EXPLAIN SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t2 const PRIMARY,a2 PRIMARY 4 const 1 -2 SUBQUERY t1 ref a1,b1 b1 6 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t2 NULL const PRIMARY,a2 PRIMARY 4 const 1 +2 SUBQUERY t1 NULL ref a1,b1 b1 6 const 1 Using where DROP TABLE t1,t2; CREATE TABLE t1 (i1 INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (1); @@ -440,10 +440,10 @@ EXPLAIN SELECT * FROM t1 WHERE i1 NOT IN ( SELECT i2 FROM t2 RIGHT JOIN t3 ON (c3 = c2) WHERE pk3 = i1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t3 const PRIMARY PRIMARY 4 const 1 -2 DEPENDENT SUBQUERY t2 index i2 i2 11 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t3 NULL const PRIMARY PRIMARY 4 const 1 +2 DEPENDENT SUBQUERY t2 NULL index i2 i2 11 NULL 2 Using where; Using index DROP TABLE t1,t2,t3; # # MDEV-7599: in-to-exists chosen after min/max optimization @@ -456,20 +456,20 @@ INSERT INTO t2 VALUES (1,6),(2,4), (8,9); SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b); b c EXPLAIN EXTENDED SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t1 index NULL a 5 NULL 2 100.00 Using index -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t1 NULL index NULL a 5 NULL 2 100.00 Using index +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,`test`.`t2`.`b` in ( <materialize> (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t2`.`b` ), <primary_index_lookup>(`test`.`t2`.`b` in <temporary table> on distinct_key where `test`.`t2`.`b` = `<subquery2>`.`MIN(a)`)))) set optimizer_switch= 'materialization=off'; SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b); b c EXPLAIN EXTENDED SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t1 index NULL a 5 NULL 2 100.00 Using index -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL index NULL a 5 NULL 2 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,<exists>(/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t2`.`b` having trigcond(<cache>(`test`.`t2`.`b`) = <ref_null_helper>(min(`test`.`t1`.`a`)))))) set optimizer_switch= @optimizer_switch_save; @@ -499,9 +499,9 @@ a 9 explain select * from t1 where a in (select max(a) from t1 where a < 4) or a > 5; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index idx idx 5 NULL 5 Using where; Using index -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index idx idx 5 NULL 5 Using where; Using index +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away drop table t1; # # MDEV-13135: subquery with ON expression subject to diff --git a/mysql-test/main/subselect_no_exists_to_in.result b/mysql-test/main/subselect_no_exists_to_in.result index 70add4d1740..fd01ca18b0e 100644 --- a/mysql-test/main/subselect_no_exists_to_in.result +++ b/mysql-test/main/subselect_no_exists_to_in.result @@ -15,8 +15,8 @@ select (select 2); (select 2) 2 explain extended select (select 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 select 2 AS `(select 2)` @@ -25,10 +25,10 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2); 1 2 explain extended SELECT (SELECT 1) UNION SELECT (SELECT 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1249 Select 2 was reduced during optimization Note 1249 Select 4 was reduced during optimization @@ -37,11 +37,11 @@ SELECT (SELECT (SELECT 0 UNION SELECT 0)); (SELECT (SELECT 0 UNION SELECT 0)) 0 explain extended SELECT (SELECT (SELECT 0 UNION SELECT 0)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 /* select#1 */ select (/* select#3 */ select 0 union /* select#4 */ select 0) AS `(SELECT (SELECT 0 UNION SELECT 0))` @@ -55,10 +55,10 @@ SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a; SELECT (SELECT a) as a; ERROR 42S22: Reference 'a' not supported (forward reference in item list) EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00 -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 1 100.00 +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 @@ -197,12 +197,12 @@ a b 4 8 3 8 explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using filesort -3 UNION t4 ALL NULL NULL NULL NULL 3 100.00 Using where -4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort +3 UNION t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +4 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (/* select#3 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (/* select#4 */ select max(`test`.`t2`.`a`) * 4 from `test`.`t2`)) select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2; @@ -217,10 +217,10 @@ set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from (select * from t2 where a>1) as tt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (/* select#3 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt` set optimizer_switch=@tmp_optimizer_switch; @@ -238,10 +238,10 @@ b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) 8 4.5000 9 7.5000 explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` @@ -286,9 +286,9 @@ a 6 7 explain extended select * from t3 where a >= any (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2); @@ -326,11 +326,11 @@ select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) NULL 1 2 2 explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 -3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 +3 DEPENDENT UNION t5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 @@ -347,9 +347,9 @@ patient_uq clinic_uq 1 2 2 2 explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t6 ALL NULL NULL NULL NULL 4 100.00 Using where -2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t6 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +2 DEPENDENT SUBQUERY t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index Warnings: Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(/* select#2 */ select 1 from `test`.`t7` where `test`.`t7`.`uq` = `test`.`t6`.`clinic_uq` limit 1)) @@ -381,11 +381,11 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce','test'); INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1'); INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1'); EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index -4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index -2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 -3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index +4 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index +2 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 +3 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index Warnings: Note 1003 /* select#1 */ select 'joce' AS `pseudo`,(/* select#2 */ select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1 SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM @@ -410,14 +410,14 @@ KEY `topic` (`topic`) INSERT INTO t1 (topic,date,pseudo) VALUES ('43506','2002-10-02','joce'),('40143','2002-08-03','joce'); EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03' EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 NULL index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; @@ -434,11 +434,11 @@ SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1; SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1; ERROR 21000: Subquery returns more than 1 row EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL topic 3 NULL 2 100.00 Using index -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL topic 3 NULL 2 100.00 Using index +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 drop table t1; @@ -563,14 +563,14 @@ ERROR 21000: Subquery returns more than 1 row SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1'); ERROR 21000: Subquery returns more than 1 row EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1' EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 /* select#1 */ select 3 AS `numreponse` from `test`.`t1` where 1 drop table t1; @@ -741,8 +741,8 @@ SELECT * FROM t2 WHERE id IN (SELECT 1); id 1 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref id id 5 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref id id 5 const 1 100.00 Using index Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1 @@ -753,18 +753,18 @@ SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1)); id 2 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref id id 5 const 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref id id 5 const 1 100.00 Using where; Using index Warnings: Note 1249 Select 3 was reduced during optimization Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = <cache>(1 + 1) EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL id 5 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`id` AS `id` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(/* select#2 */ select 1 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(1) union /* select#3 */ select 3 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(3)))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); @@ -887,8 +887,8 @@ select 10.5 > ANY (SELECT * from t1); 10.5 > ANY (SELECT * from t1) 1 explain extended select (select a+1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization @@ -910,9 +910,9 @@ a t1.a in (select t2.a from t2) 3 1 4 0 explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +2 SUBQUERY t2 NULL index_subquery a a 5 func 2 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` CREATE TABLE t3 (a int(11) default '0'); @@ -924,10 +924,10 @@ a t1.a in (select t2.a from t2,t3 where t3.a=t2.a) 3 1 4 0 explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL ref_or_null a a 5 func 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` drop table t1,t2,t3; @@ -1164,21 +1164,21 @@ i drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1270,10 +1270,10 @@ create table t1 (a int); insert into t1 values (1), (2), (3); explain extended select a,(select (select rand() from t1 limit 1) from t1 limit 1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 -3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 UNCACHEABLE SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +3 UNCACHEABLE SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,(/* select#2 */ select (/* select#3 */ select rand() from `test`.`t1` limit 1) from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1` drop table t1; @@ -1325,9 +1325,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) 0 EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 /* select#1 */ select <in_optimizer>(0,<exists>(/* select#2 */ select 1 from dual where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); @@ -1335,9 +1335,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) 0 EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 /* select#1 */ select <in_optimizer>(0,<exists>(/* select#2 */ select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; @@ -1380,9 +1380,9 @@ drop table t1; create table t1 (id int not null auto_increment primary key, salary int, key(salary)); insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000); explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref salary salary 5 const 1 100.00 Using where +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (/* select#2 */ select max(`test`.`t1`.`salary`) from `test`.`t1`) drop table t1; @@ -1442,9 +1442,9 @@ a 3 4 explain extended select * from t2 where t2.a in (select a from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1452,9 +1452,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1462,10 +1462,10 @@ a 2 3 explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 -1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 +1 PRIMARY t3 NULL index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a` drop table t1, t2, t3; @@ -1485,9 +1485,9 @@ a 3 4 explain extended select * from t2 where t2.a in (select a from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1495,9 +1495,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1505,10 +1505,10 @@ a 2 3 explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t3 range a a 5 NULL 3 100.00 Using where; Using index -1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t3 NULL range a a 5 NULL 3 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where `test`.`t1`.`b` = `test`.`t3`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a` insert into t1 values (3,31); @@ -1522,9 +1522,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 drop table t0, t1, t2, t3; @@ -1580,8 +1580,8 @@ select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' fr s1 tttt explain extended (select * from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 (select 'tttt' AS `s1` from dual) (select * from t1); @@ -1613,27 +1613,27 @@ a1 0 a2 1 a3 1 explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; @@ -1646,17 +1646,17 @@ a 7 3 explain extended select * from t3 where a >= all (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); a explain extended select * from t3 where a >= some (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1665,49 +1665,49 @@ a 7 3 explain extended select * from t3 where a >= all (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); a explain extended select * from t3 where a >= some (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); a explain extended select * from t3 where NULL >= any (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= any (select b from t2 group by 1); a explain extended select * from t3 where NULL >= any (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= some (select b from t2); a explain extended select * from t3 where NULL >= some (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= some (select b from t2 group by 1); a explain extended select * from t3 where NULL >= some (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 insert into t2 values (2,2), (2,1), (3,3), (3,1); @@ -1716,9 +1716,9 @@ a 6 7 explain extended select * from t3 where a > all (select max(b) from t2 group by a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,<max>(/* select#2 */ select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))) drop table t2, t3; @@ -1765,11 +1765,11 @@ select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1); s1 e explain extended select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 -3 UNION t1 system NULL NULL NULL NULL 1 100.00 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 +3 UNION t1 NULL system NULL NULL NULL NULL 1 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 'e' AS `s1` from dual where 1 drop table t1; @@ -1886,15 +1886,15 @@ id text 11 text11 12 text12 explain extended select * from t1 where id not in (select id from t1 where id < 8); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where -2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 12 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and <cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`)))) explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where -2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY tt NULL ALL NULL NULL NULL NULL 12 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<expr_cache><`test`.`tt`.`id`>(exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null limit 1)) @@ -1918,19 +1918,19 @@ id text id text id text 1000 text1000 NULL NULL 1000 text1000 1001 text1001 NULL NULL 1000 text1000 explain extended select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE a ALL NULL NULL NULL NULL 14 100.00 -1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 -1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a NULL ALL NULL NULL NULL NULL 14 100.00 +1 SIMPLE b NULL eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 +1 SIMPLE c NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition Warnings: Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id` drop table t1,t2; create table t1 (a int); insert into t1 values (1); explain select benchmark(1000, (select a from t1 where a=sha(rand()))); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 1 drop table t1; create table t1(id int); create table t2(id int); @@ -2428,9 +2428,9 @@ a b 1 2 3 4 explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY up NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(exists(/* select#2 */ select 1 from `test`.`t1` where `test`.`t1`.`a` = `test`.`up`.`a` limit 1)) @@ -2603,16 +2603,16 @@ create table t1 (a int not null, b int not null, c int, primary key (a,b)); insert into t1 values (1,1,1), (2,2,2), (3,3,3); set @b:= 0; explain select sum(a) from t1 where b > @b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 3 Using where; Using index set @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where drop table t1; connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection root; @@ -2976,22 +2976,22 @@ one two test 10 5 NULL 10 10 NULL explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0') as 'test' from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(/* select#2 */ select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1` explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`flag` = 'N' explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(/* select#2 */ select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1` DROP TABLE t1,t2; @@ -3113,10 +3113,10 @@ test.t1 analyze status OK explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 -1 PRIMARY r const PRIMARY PRIMARY 4 const 1 -2 SUBQUERY t2 range b b 40 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 +1 PRIMARY r NULL const PRIMARY PRIMARY 4 const 1 +2 SUBQUERY t2 NULL range b b 40 NULL 3 Using where SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; @@ -3125,10 +3125,10 @@ a a b explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 -1 PRIMARY r const PRIMARY PRIMARY 4 const 1 -2 SUBQUERY t2 range b b 40 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 +1 PRIMARY r NULL const PRIMARY PRIMARY 4 const 1 +2 SUBQUERY t2 NULL range b b 40 NULL 3 Using index condition SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; @@ -3177,9 +3177,9 @@ INSERT INTO t1 VALUES (NULL); CREATE TABLE t2(a int); INSERT INTO t2 VALUES (1),(2),(3); EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -2 SUBQUERY t1 index_subquery a a 5 func 3 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +2 SUBQUERY t1 NULL index_subquery a a 5 func 3 Using index; Full scan on NULL key SELECT a, a IN (SELECT a FROM t1) FROM t2; a a IN (SELECT a FROM t1) 1 1 @@ -3212,9 +3212,9 @@ a 1 2 EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE DROP TABLE t1; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (2), (4), (1), (3); @@ -3577,10 +3577,10 @@ CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 9 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 Using temporary ALTER TABLE t1 ADD INDEX(a); SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); a b @@ -3589,10 +3589,10 @@ CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL a NULL NULL NULL 9 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 9 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL a NULL NULL NULL 9 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 Using temporary DROP TABLE t1; create table t1( f1 int,f2 int); insert into t1 values (1,1),(2,2); @@ -3712,10 +3712,10 @@ SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 ORDER BY t1.t DESC LIMIT 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index -2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t1 NULL index NULL PRIMARY 13 NULL 11 Using where; Using index +2 SUBQUERY t1 NULL range PRIMARY PRIMARY 13 NULL 6 Using where; Using index SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 @@ -3737,18 +3737,18 @@ WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1))); i explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12)) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b)); insert into t1 (a) values (FLOOR(rand() * 100)); @@ -4216,9 +4216,9 @@ DROP TABLE t1,t2; CREATE TABLE t1 (a int, b int, KEY (a)); INSERT INTO t1 VALUES (1,1),(2,1); EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref a a 5 const 1 Using where; Using index -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref a a 5 const 1 Using where; Using index +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort DROP TABLE t1; CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); INSERT INTO t1 VALUES @@ -4254,9 +4254,9 @@ CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1), (2); EXPLAIN EXTENDED SELECT * FROM (SELECT count(*) FROM t1 GROUP BY a) as res; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `res`.`count(*)` AS `count(*)` from (/* select#2 */ select count(0) AS `count(*)` from `test`.`t1` group by `test`.`t1`.`a`) `res` DROP TABLE t1; @@ -4390,9 +4390,9 @@ a b CREATE INDEX I1 ON t1 (a); CREATE INDEX I2 ON t1 (b); EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL I2 NULL NULL NULL 2 Using where -1 PRIMARY t1 ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1); a b CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10)); @@ -4400,16 +4400,16 @@ INSERT INTO t2 SELECT * FROM t1; CREATE INDEX I1 ON t2 (a); CREATE INDEX I2 ON t2 (b); EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL I2 NULL NULL NULL 2 Using where -1 PRIMARY t2 ref I1 I1 4 test.t2.b 2 Using where; Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL I2 NULL NULL NULL 2 Using where +1 PRIMARY t2 NULL ref I1 I1 4 test.t2.b 2 Using where; Using index; FirstMatch(t2) SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2); a b EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL I2 NULL NULL NULL 2 Using where -1 PRIMARY t1 ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500); a b DROP TABLE t1,t2; @@ -4429,9 +4429,9 @@ EXPLAIN SELECT a AS out_a, MIN(b) FROM t1 t1_outer WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_outer ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer NULL ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 4 Using where SELECT a AS out_a, MIN(b) FROM t1 t1_outer WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) GROUP BY a; @@ -4449,20 +4449,20 @@ SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a)); 2 EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` limit 1)) EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION (SELECT 1 FROM t2 WHERE t1.a = t2.a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 @@ -4542,17 +4542,17 @@ INSERT INTO t1 VALUES (1),(2); SET @save_join_cache_level=@@join_cache_level; SET join_cache_level=0; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL const distinct_key distinct_key 4 const 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select 1 AS `1` from <materialize> (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1 EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL const distinct_key distinct_key 4 const 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary Warnings: Note 1003 /* select#1 */ select 1 AS `1` from <materialize> (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` where `test`.`t1`.`a` > 3 group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1 SET join_cache_level=@save_join_cache_level; @@ -4575,8 +4575,8 @@ int_nokey int_key 5 5 0 0 EXPLAIN EXTENDED SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE C ALL NULL NULL NULL NULL 20 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE C NULL ALL NULL NULL NULL NULL 20 100.00 Using where DROP TABLE C; # End of test for bug#45061. # @@ -4597,9 +4597,9 @@ EXPLAIN SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; @@ -4619,10 +4619,10 @@ EXPLAIN SELECT * FROM t2 outr WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) ORDER BY outr.pk; -id select_type table type possible_keys key key_len ref rows Extra -x x outr ALL x x x x x x -x x t1 eq_ref x x x x x x -x x t2 index x x x x x x +id select_type table partitions type possible_keys key key_len ref rows Extra +x x outr x ALL x x x x x x +x x t1 x eq_ref x x x x x x +x x t2 x index x x x x x x # should not crash on debug binaries SELECT * FROM t2 outr WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) @@ -4641,9 +4641,9 @@ SELECT @@session.sql_mode INTO @old_sql_mode; SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1); @@ -4989,10 +4989,10 @@ KEY b_2 (b) INSERT INTO t3 VALUES (1,1,1), (2,32,1), (3,33,1), (4,34,2); explain SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 Using index -1 PRIMARY t3 ref b,b_2 b 5 test.t1.a 1 Using index -2 DEPENDENT SUBQUERY t2 ref b,b_2,c b 10 test.t3.c,test.t1.a 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 Using index +1 PRIMARY t3 NULL ref b,b_2 b 5 test.t1.a 1 Using index +2 DEPENDENT SUBQUERY t2 NULL ref b,b_2,c b 10 test.t3.c,test.t1.a 1 Using where; Using index SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a; a incorrect 1 1 @@ -5687,12 +5687,12 @@ a a explain SELECT * FROM ot1,ot4 WHERE (ot1.a,ot4.a) IN (SELECT it2.a,it3.a FROM it2,it3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot1 ALL NULL NULL NULL NULL 2 -1 PRIMARY ot4 ALL NULL NULL NULL NULL 8 Using join buffer (flat, BNL join) -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -2 MATERIALIZED it2 ALL NULL NULL NULL NULL 4 -2 MATERIALIZED it3 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY ot4 NULL ALL NULL NULL NULL NULL 8 Using join buffer (flat, BNL join) +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED it2 NULL ALL NULL NULL NULL NULL 4 +2 MATERIALIZED it3 NULL ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) DROP TABLE IF EXISTS ot1, ot4, it2, it3; # # Bug#729039: NULL keys used to evaluate subquery @@ -5708,9 +5708,9 @@ a EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 USE INDEX() WHERE t2.a = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a); a @@ -5718,9 +5718,9 @@ a EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2 ref idx idx 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2 NULL ref idx idx 5 test.t1.a 2 Using index DROP TABLE t1,t2; # # BUG#752992: Wrong results for a subquery with 'semijoin=on' @@ -5736,10 +5736,10 @@ INSERT INTO t2 VALUES (15,4); SET @save_join_cache_level=@@join_cache_level; SET join_cache_level=0; EXPLAIN SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 3 -1 PRIMARY it eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 Using index -1 PRIMARY t2 index NULL PRIMARY 4 NULL 3 Using index; FirstMatch(it) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 3 +1 PRIMARY it NULL eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 Using index +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 3 Using index; FirstMatch(it) SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1); pk i 11 0 @@ -5759,9 +5759,9 @@ EXPLAIN SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; @@ -6002,12 +6002,12 @@ drop view v1; CREATE TABLE t1 (a INT, b INT, INDEX (a)); INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20); EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 5 const 1 EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 SUBQUERY t1 ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 SUBQUERY t1 NULL ref a a 5 const 1 Using index DROP TABLE t1; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6022,10 +6022,10 @@ EXPLAIN SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2 WHERE EXISTS (SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY table1 ALL NULL NULL NULL NULL 2 -1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 Using where; Using index SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2 WHERE EXISTS (SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1); @@ -6078,10 +6078,10 @@ EXPLAIN SELECT col_int_nokey FROM ot WHERE col_varchar_nokey IN (SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot system NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it1 ref idx_cvk_cik idx_cvk_cik 9 const,const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it1 NULL ref idx_cvk_cik idx_cvk_cik 9 const,const 1 Using where; Using index SELECT col_int_nokey FROM ot WHERE col_varchar_nokey IN (SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL); @@ -6091,10 +6091,10 @@ EXPLAIN SELECT col_int_nokey FROM ot WHERE (col_varchar_nokey, 'x') IN (SELECT col_varchar_key, col_varchar_key2 FROM it2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot system NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -2 MATERIALIZED it2 ref idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 const,const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED it2 NULL ref idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 const,const 1 Using where; Using index SELECT col_int_nokey FROM ot WHERE (col_varchar_nokey, 'x') IN (SELECT col_varchar_key, col_varchar_key2 FROM it2); @@ -6138,8 +6138,8 @@ EXPLAIN SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE sq4_alias1 NULL system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6152,9 +6152,9 @@ EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found -2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 0 Const row not found +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6175,9 +6175,9 @@ c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 FROM t2 AS c_sq1_alias1 WHERE (c_sq1_alias1.col_int_nokey != @var2 OR c_sq1_alias1.pk != @var3)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 SELECT sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) @@ -6197,9 +6197,9 @@ c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 FROM t2 AS c_sq1_alias1 WHERE (c_sq1_alias1.col_int_nokey != @var2 OR c_sq1_alias1.pk != @var3)) ) AS alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 SELECT * FROM ( SELECT sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) @@ -6248,10 +6248,10 @@ EXPLAIN SELECT t2.b , t1.c FROM t2 LEFT JOIN t1 ON t1.c < 3 WHERE (t2.b , t1.c) NOT IN (SELECT * from t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t2.b , t1.c FROM t2 LEFT JOIN t1 ON t1.c < 3 WHERE (t2.b, t1.c) NOT IN (SELECT * from t3); @@ -6270,15 +6270,15 @@ INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20); set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED t1 ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED t1 NULL ref a a 5 const 1 set optimizer_switch=@tmp_optimizer_switch; EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 SUBQUERY t1 ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 SUBQUERY t1 NULL ref a a 5 const 1 Using index DROP TABLE t1; # @@ -6407,10 +6407,10 @@ WHERE EXISTS SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY table1 ALL NULL NULL NULL NULL 2 -1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 Using where; Using index DROP TABLE t1,t2; # # lp:826279: assertion failure with GROUP BY a result of subquery @@ -6636,18 +6636,18 @@ INSERT INTO t1 VALUES ('2009-01-01'),('2009-02-02'); set @old_optimizer_switch = @@optimizer_switch; SET @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index -2 DEPENDENT SUBQUERY t1 index_subquery a a 4 func 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 4 func 2 Using index SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); a 2009-01-01 2009-02-02 SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index -2 MATERIALIZED t1 index NULL a 4 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 Using where; Using index +2 MATERIALIZED t1 NULL index NULL a 4 NULL 2 Using index SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); a 2009-01-01 @@ -6698,33 +6698,33 @@ CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; INSERT INTO t2 VALUES (3,'f'); EXPLAIN SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 NULL EXPLAIN SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 0 EXPLAIN SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 1 EXPLAIN SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 0 @@ -6738,12 +6738,12 @@ INSERT INTO t1 VALUES (7),(0); CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; f1 f2 drop table t1,t2; @@ -6755,20 +6755,20 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(7); EXPLAIN SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1; min_a a EXPLAIN SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT UNION t1 NULL ALL NULL NULL NULL NULL 2 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1; min_a a drop table t1; @@ -6827,9 +6827,9 @@ SELECT MAX( alias2.a ) AS field FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR alias1.a = 'y' HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible HAVING -2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 Using index; Using where SELECT MAX( alias2.a ) AS field FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR alias1.a = 'y' @@ -6839,11 +6839,11 @@ EXPLAIN SELECT MAX( alias2.a ) FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index -1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index -1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join) -2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL index a a 19 NULL 11 Using where; Using index +1 PRIMARY alias2 NULL ref a a 19 test.alias1.a 2 Using index +1 PRIMARY alias3 NULL index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 Using index; Using where SELECT MAX( alias2.a ) FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 ); @@ -6861,12 +6861,12 @@ INSERT INTO t2 VALUES (1),(7); EXPLAIN SELECT * FROM t1 WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2)); a1 @@ -6885,13 +6885,13 @@ set @@expensive_subquery_limit= 0; EXPLAIN SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 flush status; SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; @@ -6923,13 +6923,13 @@ set @@expensive_subquery_limit= default; EXPLAIN SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 flush status; SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; @@ -6967,10 +6967,10 @@ CREATE TABLE t2 (b INT PRIMARY KEY); INSERT INTO t2 VALUES (1),(2); EXPLAIN SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1)); a drop table t1,t2; @@ -6989,11 +6989,11 @@ insert into t4 select * from t3; explain SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1 WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL b NULL NULL NULL 2 Using where -1 PRIMARY t3 ref d d 5 test.t2.b 2 Using index -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL b NULL NULL NULL 2 Using where +1 PRIMARY t3 NULL ref d d 5 test.t2.b 2 Using index +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away set @tmp_mdev410=@@global.userstat; set global userstat=on; flush table_statistics; @@ -7021,10 +7021,10 @@ INSERT INTO t1 VALUES (1),(8); CREATE TABLE t2 (b INT, KEY(b)); INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index -2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL range a a 5 NULL 2 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # # MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields @@ -7038,11 +7038,11 @@ INSERT INTO t3 VALUES ('b'),('c'); EXPLAIN SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index -2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index a a 5 NULL 2 Using where; Using index +2 SUBQUERY <subquery3> NULL ALL distinct_key NULL NULL NULL 1 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; a @@ -7055,10 +7055,10 @@ INSERT INTO t1 VALUES (1),(8); CREATE TABLE t2 (b INT, KEY(b)); INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index -2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL range a a 5 NULL 2 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # # MDEV-5991: crash in Item_field::used_tables @@ -7260,13 +7260,13 @@ insert into t1 values (3), (1), (7); create table t2 (b int, index idx(b)); insert into t2 values (2), (5), (3), (2); explain select * from t1 where (select max(b) from t2) = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away drop table t1,t2; # # MDEV-19429: Wrong query result with EXISTS and LIMIT 0 @@ -7278,9 +7278,9 @@ insert into t12 values (1),(2),(3); select * from t10 where exists (select * from t12 order by a limit 0); a explain select * from t10 where exists (select * from t12 order by a limit 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Zero limit +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Zero limit prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)"; set @l=1; execute stmt1 using @l; diff --git a/mysql-test/main/subselect_no_mat.result b/mysql-test/main/subselect_no_mat.result index f0c7033803c..9e218496722 100644 --- a/mysql-test/main/subselect_no_mat.result +++ b/mysql-test/main/subselect_no_mat.result @@ -18,8 +18,8 @@ select (select 2); (select 2) 2 explain extended select (select 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 select 2 AS `(select 2)` @@ -28,10 +28,10 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2); 1 2 explain extended SELECT (SELECT 1) UNION SELECT (SELECT 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1249 Select 2 was reduced during optimization Note 1249 Select 4 was reduced during optimization @@ -40,11 +40,11 @@ SELECT (SELECT (SELECT 0 UNION SELECT 0)); (SELECT (SELECT 0 UNION SELECT 0)) 0 explain extended SELECT (SELECT (SELECT 0 UNION SELECT 0)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 /* select#1 */ select (/* select#3 */ select 0 union /* select#4 */ select 0) AS `(SELECT (SELECT 0 UNION SELECT 0))` @@ -58,10 +58,10 @@ SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a; SELECT (SELECT a) as a; ERROR 42S22: Reference 'a' not supported (forward reference in item list) EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00 -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 1 100.00 +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 @@ -200,12 +200,12 @@ a b 4 8 3 8 explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using filesort -3 UNION t4 ALL NULL NULL NULL NULL 3 100.00 Using where -4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort +3 UNION t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +4 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (/* select#3 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (/* select#4 */ select max(`test`.`t2`.`a`) * 4 from `test`.`t2`)) select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2; @@ -220,10 +220,10 @@ set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from (select * from t2 where a>1) as tt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (/* select#3 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt` set optimizer_switch=@tmp_optimizer_switch; @@ -241,10 +241,10 @@ b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) 8 4.5000 9 7.5000 explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` @@ -289,9 +289,9 @@ a 6 7 explain extended select * from t3 where a >= any (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2); @@ -329,11 +329,11 @@ select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) NULL 1 2 2 explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 -3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 +3 DEPENDENT UNION t5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 @@ -350,9 +350,9 @@ patient_uq clinic_uq 1 2 2 2 explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index -1 PRIMARY t6 ALL i1 NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t7 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +1 PRIMARY t6 NULL ALL i1 NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq` @@ -384,11 +384,11 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce','test'); INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1'); INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1'); EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index -4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index -2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 -3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index +4 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index +2 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 +3 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index Warnings: Note 1003 /* select#1 */ select 'joce' AS `pseudo`,(/* select#2 */ select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1 SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM @@ -413,14 +413,14 @@ KEY `topic` (`topic`) INSERT INTO t1 (topic,date,pseudo) VALUES ('43506','2002-10-02','joce'),('40143','2002-08-03','joce'); EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03' EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 NULL index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; @@ -437,11 +437,11 @@ SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1; SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1; ERROR 21000: Subquery returns more than 1 row EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL topic 3 NULL 2 100.00 Using index -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL topic 3 NULL 2 100.00 Using index +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 drop table t1; @@ -566,14 +566,14 @@ ERROR 21000: Subquery returns more than 1 row SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1'); ERROR 21000: Subquery returns more than 1 row EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1' EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 /* select#1 */ select 3 AS `numreponse` from `test`.`t1` where 1 drop table t1; @@ -744,8 +744,8 @@ SELECT * FROM t2 WHERE id IN (SELECT 1); id 1 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref id id 5 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref id id 5 const 1 100.00 Using index Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1 @@ -756,18 +756,18 @@ SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1)); id 2 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref id id 5 const 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref id id 5 const 1 100.00 Using where; Using index Warnings: Note 1249 Select 3 was reduced during optimization Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = <cache>(1 + 1) EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL id 5 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`id` AS `id` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(/* select#2 */ select 1 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(1) union /* select#3 */ select 3 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(3)))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); @@ -890,8 +890,8 @@ select 10.5 > ANY (SELECT * from t1); 10.5 > ANY (SELECT * from t1) 1 explain extended select (select a+1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization @@ -913,9 +913,9 @@ a t1.a in (select t2.a from t2) 3 1 4 0 explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +2 SUBQUERY t2 NULL index_subquery a a 5 func 2 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` CREATE TABLE t3 (a int(11) default '0'); @@ -927,10 +927,10 @@ a t1.a in (select t2.a from t2,t3 where t3.a=t2.a) 3 1 4 0 explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL ref_or_null a a 5 func 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` drop table t1,t2,t3; @@ -1167,21 +1167,21 @@ i drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1273,10 +1273,10 @@ create table t1 (a int); insert into t1 values (1), (2), (3); explain extended select a,(select (select rand() from t1 limit 1) from t1 limit 1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 -3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 UNCACHEABLE SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +3 UNCACHEABLE SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,(/* select#2 */ select (/* select#3 */ select rand() from `test`.`t1` limit 1) from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1` drop table t1; @@ -1328,9 +1328,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) 0 EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 /* select#1 */ select <in_optimizer>(0,<exists>(/* select#2 */ select 1 from dual where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); @@ -1338,9 +1338,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) 0 EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 /* select#1 */ select <in_optimizer>(0,<exists>(/* select#2 */ select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; @@ -1383,9 +1383,9 @@ drop table t1; create table t1 (id int not null auto_increment primary key, salary int, key(salary)); insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000); explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref salary salary 5 const 1 100.00 Using where +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (/* select#2 */ select max(`test`.`t1`.`salary`) from `test`.`t1`) drop table t1; @@ -1445,9 +1445,9 @@ a 3 4 explain extended select * from t2 where t2.a in (select a from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1455,9 +1455,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1465,10 +1465,10 @@ a 2 3 explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 -1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 +1 PRIMARY t3 NULL index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a` drop table t1, t2, t3; @@ -1488,9 +1488,9 @@ a 3 4 explain extended select * from t2 where t2.a in (select a from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1498,9 +1498,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1508,10 +1508,10 @@ a 2 3 explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t3 range a a 5 NULL 3 100.00 Using where; Using index -1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t3 NULL range a a 5 NULL 3 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where `test`.`t1`.`b` = `test`.`t3`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a` insert into t1 values (3,31); @@ -1525,9 +1525,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 drop table t0, t1, t2, t3; @@ -1583,8 +1583,8 @@ select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' fr s1 tttt explain extended (select * from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 (select 'tttt' AS `s1` from dual) (select * from t1); @@ -1616,27 +1616,27 @@ a1 0 a2 1 a3 1 explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; @@ -1649,17 +1649,17 @@ a 7 3 explain extended select * from t3 where a >= all (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); a explain extended select * from t3 where a >= some (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1668,49 +1668,49 @@ a 7 3 explain extended select * from t3 where a >= all (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); a explain extended select * from t3 where a >= some (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); a explain extended select * from t3 where NULL >= any (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= any (select b from t2 group by 1); a explain extended select * from t3 where NULL >= any (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= some (select b from t2); a explain extended select * from t3 where NULL >= some (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= some (select b from t2 group by 1); a explain extended select * from t3 where NULL >= some (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 insert into t2 values (2,2), (2,1), (3,3), (3,1); @@ -1719,9 +1719,9 @@ a 6 7 explain extended select * from t3 where a > all (select max(b) from t2 group by a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,<max>(/* select#2 */ select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))) drop table t2, t3; @@ -1768,11 +1768,11 @@ select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1); s1 e explain extended select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 -3 UNION t1 system NULL NULL NULL NULL 1 100.00 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 +3 UNION t1 NULL system NULL NULL NULL NULL 1 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 'e' AS `s1` from dual where 1 drop table t1; @@ -1889,15 +1889,15 @@ id text 11 text11 12 text12 explain extended select * from t1 where id not in (select id from t1 where id < 8); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where -2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 12 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and <cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`)))) explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where -2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY tt NULL ALL NULL NULL NULL NULL 12 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null limit 1))) @@ -1921,19 +1921,19 @@ id text id text id text 1000 text1000 NULL NULL 1000 text1000 1001 text1001 NULL NULL 1000 text1000 explain extended select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE a ALL NULL NULL NULL NULL 14 100.00 -1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 -1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a NULL ALL NULL NULL NULL NULL 14 100.00 +1 SIMPLE b NULL eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 +1 SIMPLE c NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition Warnings: Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id` drop table t1,t2; create table t1 (a int); insert into t1 values (1); explain select benchmark(1000, (select a from t1 where a=sha(rand()))); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 1 drop table t1; create table t1(id int); create table t2(id int); @@ -2431,9 +2431,9 @@ a b 1 2 3 4 explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(up); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY up NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(up); Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`up`.`a` @@ -2606,16 +2606,16 @@ create table t1 (a int not null, b int not null, c int, primary key (a,b)); insert into t1 values (1,1,1), (2,2,2), (3,3,3); set @b:= 0; explain select sum(a) from t1 where b > @b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 3 Using where; Using index set @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where drop table t1; connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection root; @@ -2979,21 +2979,21 @@ one two test 10 5 NULL 10 10 NULL explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0') as 'test' from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(/* select#2 */ select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1` explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where; FirstMatch(t1) Warnings: Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`flag` = 'N' and `test`.`t2`.`one` = `test`.`t1`.`one` and `test`.`t2`.`two` = `test`.`t1`.`two` explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(/* select#2 */ select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null)))) AS `test` from `test`.`t1` DROP TABLE t1,t2; @@ -3115,10 +3115,10 @@ test.t1 analyze status OK explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 -1 PRIMARY r const PRIMARY PRIMARY 4 const 1 -2 SUBQUERY t2 range b b 40 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 +1 PRIMARY r NULL const PRIMARY PRIMARY 4 const 1 +2 SUBQUERY t2 NULL range b b 40 NULL 3 Using where SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; @@ -3127,10 +3127,10 @@ a a b explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 -1 PRIMARY r const PRIMARY PRIMARY 4 const 1 -2 SUBQUERY t2 range b b 40 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 +1 PRIMARY r NULL const PRIMARY PRIMARY 4 const 1 +2 SUBQUERY t2 NULL range b b 40 NULL 3 Using index condition SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; @@ -3179,9 +3179,9 @@ INSERT INTO t1 VALUES (NULL); CREATE TABLE t2(a int); INSERT INTO t2 VALUES (1),(2),(3); EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -2 SUBQUERY t1 index_subquery a a 5 func 3 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +2 SUBQUERY t1 NULL index_subquery a a 5 func 3 Using index; Full scan on NULL key SELECT a, a IN (SELECT a FROM t1) FROM t2; a a IN (SELECT a FROM t1) 1 1 @@ -3214,9 +3214,9 @@ a 1 2 EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE DROP TABLE t1; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (2), (4), (1), (3); @@ -3579,9 +3579,9 @@ CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 9 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 9 Using temporary ALTER TABLE t1 ADD INDEX(a); SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); a b @@ -3590,9 +3590,9 @@ CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where -2 DEPENDENT SUBQUERY t1 index NULL a 8 NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 9 Using where +2 DEPENDENT SUBQUERY t1 NULL index NULL a 8 NULL 1 DROP TABLE t1; create table t1( f1 int,f2 int); insert into t1 values (1,1),(2,2); @@ -3712,10 +3712,10 @@ SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 ORDER BY t1.t DESC LIMIT 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index -2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t1 NULL index NULL PRIMARY 13 NULL 11 Using where; Using index +2 SUBQUERY t1 NULL range PRIMARY PRIMARY 13 NULL 6 Using where; Using index SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 @@ -3737,18 +3737,18 @@ WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1))); i explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12)) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b)); insert into t1 (a) values (FLOOR(rand() * 100)); @@ -4216,9 +4216,9 @@ DROP TABLE t1,t2; CREATE TABLE t1 (a int, b int, KEY (a)); INSERT INTO t1 VALUES (1,1),(2,1); EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref a a 5 const 1 Using where; Using index -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref a a 5 const 1 Using where; Using index +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort DROP TABLE t1; CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); INSERT INTO t1 VALUES @@ -4254,9 +4254,9 @@ CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1), (2); EXPLAIN EXTENDED SELECT * FROM (SELECT count(*) FROM t1 GROUP BY a) as res; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `res`.`count(*)` AS `count(*)` from (/* select#2 */ select count(0) AS `count(*)` from `test`.`t1` group by `test`.`t1`.`a`) `res` DROP TABLE t1; @@ -4390,9 +4390,9 @@ a b CREATE INDEX I1 ON t1 (a); CREATE INDEX I2 ON t1 (b); EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL I2 NULL NULL NULL 2 Using where -1 PRIMARY t1 ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1); a b CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10)); @@ -4400,16 +4400,16 @@ INSERT INTO t2 SELECT * FROM t1; CREATE INDEX I1 ON t2 (a); CREATE INDEX I2 ON t2 (b); EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL I2 NULL NULL NULL 2 Using where -1 PRIMARY t2 ref I1 I1 4 test.t2.b 2 Using where; Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL I2 NULL NULL NULL 2 Using where +1 PRIMARY t2 NULL ref I1 I1 4 test.t2.b 2 Using where; Using index; FirstMatch(t2) SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2); a b EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL I2 NULL NULL NULL 2 Using where -1 PRIMARY t1 ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500); a b DROP TABLE t1,t2; @@ -4429,9 +4429,9 @@ EXPLAIN SELECT a AS out_a, MIN(b) FROM t1 t1_outer WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_outer ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer NULL ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 4 Using where SELECT a AS out_a, MIN(b) FROM t1 t1_outer WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) GROUP BY a; @@ -4449,20 +4449,20 @@ SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a)); 2 EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 select 2 AS `2` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`a` = `test`.`t1`.`a` EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION (SELECT 1 FROM t2 WHERE t1.a = t2.a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 @@ -4542,15 +4542,15 @@ INSERT INTO t1 VALUES (1),(2); SET @save_join_cache_level=@@join_cache_level; SET join_cache_level=0; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 0 SET join_cache_level=@save_join_cache_level; @@ -4573,8 +4573,8 @@ int_nokey int_key 5 5 0 0 EXPLAIN EXTENDED SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE C ALL NULL NULL NULL NULL 20 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE C NULL ALL NULL NULL NULL NULL 20 100.00 Using where DROP TABLE C; # End of test for bug#45061. # @@ -4595,9 +4595,9 @@ EXPLAIN SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; @@ -4617,10 +4617,10 @@ EXPLAIN SELECT * FROM t2 outr WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) ORDER BY outr.pk; -id select_type table type possible_keys key key_len ref rows Extra -x x outr ALL x x x x x x -x x t1 eq_ref x x x x x x -x x t2 index x x x x x x +id select_type table partitions type possible_keys key key_len ref rows Extra +x x outr x ALL x x x x x x +x x t1 x eq_ref x x x x x x +x x t2 x index x x x x x x # should not crash on debug binaries SELECT * FROM t2 outr WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) @@ -4639,9 +4639,9 @@ SELECT @@session.sql_mode INTO @old_sql_mode; SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1); @@ -4987,10 +4987,10 @@ KEY b_2 (b) INSERT INTO t3 VALUES (1,1,1), (2,32,1), (3,33,1), (4,34,2); explain SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 Using index -1 PRIMARY t3 ref b,b_2 b 5 test.t1.a 1 Using index -2 DEPENDENT SUBQUERY t2 ref b,b_2,c b 10 test.t3.c,test.t1.a 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 Using index +1 PRIMARY t3 NULL ref b,b_2 b 5 test.t1.a 1 Using index +2 DEPENDENT SUBQUERY t2 NULL ref b,b_2,c b 10 test.t3.c,test.t1.a 1 Using where; Using index SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a; a incorrect 1 1 @@ -5685,11 +5685,11 @@ a a explain SELECT * FROM ot1,ot4 WHERE (ot1.a,ot4.a) IN (SELECT it2.a,it3.a FROM it2,it3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot1 ALL NULL NULL NULL NULL 2 -1 PRIMARY it2 ALL NULL NULL NULL NULL 4 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY it3 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) -1 PRIMARY ot4 ALL NULL NULL NULL NULL 8 Using where; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY it2 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY it3 NULL ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) +1 PRIMARY ot4 NULL ALL NULL NULL NULL NULL 8 Using where; End temporary; Using join buffer (flat, BNL join) DROP TABLE IF EXISTS ot1, ot4, it2, it3; # # Bug#729039: NULL keys used to evaluate subquery @@ -5705,9 +5705,9 @@ a EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 USE INDEX() WHERE t2.a = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a); a @@ -5715,9 +5715,9 @@ a EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 2 Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 2 Using index; FirstMatch(t1) DROP TABLE t1,t2; # # BUG#752992: Wrong results for a subquery with 'semijoin=on' @@ -5733,10 +5733,10 @@ INSERT INTO t2 VALUES (15,4); SET @save_join_cache_level=@@join_cache_level; SET join_cache_level=0; EXPLAIN SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 3 -1 PRIMARY it eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 Using index -1 PRIMARY t2 index NULL PRIMARY 4 NULL 3 Using index; FirstMatch(it) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 3 +1 PRIMARY it NULL eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 Using index +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 3 Using index; FirstMatch(it) SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1); pk i 11 0 @@ -5756,9 +5756,9 @@ EXPLAIN SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; @@ -5999,12 +5999,12 @@ drop view v1; CREATE TABLE t1 (a INT, b INT, INDEX (a)); INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20); EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 5 const 1 EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 SUBQUERY t1 ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 SUBQUERY t1 NULL ref a a 5 const 1 Using index DROP TABLE t1; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6019,10 +6019,10 @@ EXPLAIN SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2 WHERE EXISTS (SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY table1 ALL NULL NULL NULL NULL 2 -1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 Using where; Using index SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2 WHERE EXISTS (SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1); @@ -6075,9 +6075,9 @@ EXPLAIN SELECT col_int_nokey FROM ot WHERE col_varchar_nokey IN (SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot system NULL NULL NULL NULL 1 -1 PRIMARY it1 ref idx_cvk_cik idx_cvk_cik 9 const,const 1 Using where; Using index; FirstMatch(ot) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 +1 PRIMARY it1 NULL ref idx_cvk_cik idx_cvk_cik 9 const,const 1 Using where; Using index; FirstMatch(ot) SELECT col_int_nokey FROM ot WHERE col_varchar_nokey IN (SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL); @@ -6087,9 +6087,9 @@ EXPLAIN SELECT col_int_nokey FROM ot WHERE (col_varchar_nokey, 'x') IN (SELECT col_varchar_key, col_varchar_key2 FROM it2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot system NULL NULL NULL NULL 1 -1 PRIMARY it2 ref idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 const,const 1 Using where; Using index; FirstMatch(ot) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 +1 PRIMARY it2 NULL ref idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 const,const 1 Using where; Using index; FirstMatch(ot) SELECT col_int_nokey FROM ot WHERE (col_varchar_nokey, 'x') IN (SELECT col_varchar_key, col_varchar_key2 FROM it2); @@ -6133,8 +6133,8 @@ EXPLAIN SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE sq4_alias1 NULL system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6147,9 +6147,9 @@ EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found -2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 0 Const row not found +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6170,9 +6170,9 @@ c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 FROM t2 AS c_sq1_alias1 WHERE (c_sq1_alias1.col_int_nokey != @var2 OR c_sq1_alias1.pk != @var3)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 SELECT sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) @@ -6192,9 +6192,9 @@ c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 FROM t2 AS c_sq1_alias1 WHERE (c_sq1_alias1.col_int_nokey != @var2 OR c_sq1_alias1.pk != @var3)) ) AS alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 SELECT * FROM ( SELECT sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) @@ -6243,10 +6243,10 @@ EXPLAIN SELECT t2.b , t1.c FROM t2 LEFT JOIN t1 ON t1.c < 3 WHERE (t2.b , t1.c) NOT IN (SELECT * from t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t2.b , t1.c FROM t2 LEFT JOIN t1 ON t1.c < 3 WHERE (t2.b, t1.c) NOT IN (SELECT * from t3); @@ -6265,15 +6265,15 @@ INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20); set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED t1 ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED t1 NULL ref a a 5 const 1 set optimizer_switch=@tmp_optimizer_switch; EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 SUBQUERY t1 ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 SUBQUERY t1 NULL ref a a 5 const 1 Using index DROP TABLE t1; # @@ -6402,10 +6402,10 @@ WHERE EXISTS SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY table1 ALL NULL NULL NULL NULL 2 -1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 Using where; Using index DROP TABLE t1,t2; # # lp:826279: assertion failure with GROUP BY a result of subquery @@ -6631,18 +6631,18 @@ INSERT INTO t1 VALUES ('2009-01-01'),('2009-02-02'); set @old_optimizer_switch = @@optimizer_switch; SET @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index -2 DEPENDENT SUBQUERY t1 index_subquery a a 4 func 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 4 func 2 Using index SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); a 2009-01-01 2009-02-02 SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index -2 MATERIALIZED t1 index NULL a 4 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 Using where; Using index +2 MATERIALIZED t1 NULL index NULL a 4 NULL 2 Using index SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); a 2009-01-01 @@ -6693,33 +6693,33 @@ CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; INSERT INTO t2 VALUES (3,'f'); EXPLAIN SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 NULL EXPLAIN SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 0 EXPLAIN SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 1 EXPLAIN SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 0 @@ -6733,12 +6733,12 @@ INSERT INTO t1 VALUES (7),(0); CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; f1 f2 drop table t1,t2; @@ -6750,20 +6750,20 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(7); EXPLAIN SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1; min_a a EXPLAIN SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT UNION t1 NULL ALL NULL NULL NULL NULL 2 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1; min_a a drop table t1; @@ -6822,9 +6822,9 @@ SELECT MAX( alias2.a ) AS field FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR alias1.a = 'y' HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible HAVING -2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 Using index; Using where SELECT MAX( alias2.a ) AS field FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR alias1.a = 'y' @@ -6834,11 +6834,11 @@ EXPLAIN SELECT MAX( alias2.a ) FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index -1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index -1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join) -2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL index a a 19 NULL 11 Using where; Using index +1 PRIMARY alias2 NULL ref a a 19 test.alias1.a 2 Using index +1 PRIMARY alias3 NULL index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 Using index; Using where SELECT MAX( alias2.a ) FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 ); @@ -6856,11 +6856,11 @@ INSERT INTO t2 VALUES (1),(7); EXPLAIN SELECT * FROM t1 WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where; Start temporary; Using join buffer (flat, BNL join) -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where; Start temporary; Using join buffer (flat, BNL join) +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 End temporary; Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2)); a1 @@ -6879,13 +6879,13 @@ set @@expensive_subquery_limit= 0; EXPLAIN SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 flush status; SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; @@ -6917,13 +6917,13 @@ set @@expensive_subquery_limit= default; EXPLAIN SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 flush status; SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; @@ -6961,10 +6961,10 @@ CREATE TABLE t2 (b INT PRIMARY KEY); INSERT INTO t2 VALUES (1),(2); EXPLAIN SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1)); a drop table t1,t2; @@ -6983,11 +6983,11 @@ insert into t4 select * from t3; explain SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1 WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL b NULL NULL NULL 2 Using where -1 PRIMARY t3 ref d d 5 test.t2.b 2 Using index -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL b NULL NULL NULL 2 Using where +1 PRIMARY t3 NULL ref d d 5 test.t2.b 2 Using index +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away set @tmp_mdev410=@@global.userstat; set global userstat=on; flush table_statistics; @@ -7015,10 +7015,10 @@ INSERT INTO t1 VALUES (1),(8); CREATE TABLE t2 (b INT, KEY(b)); INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index -2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL range a a 5 NULL 2 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # # MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields @@ -7032,10 +7032,10 @@ INSERT INTO t3 VALUES ('b'),('c'); EXPLAIN SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; a @@ -7048,10 +7048,10 @@ INSERT INTO t1 VALUES (1),(8); CREATE TABLE t2 (b INT, KEY(b)); INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index -2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL range a a 5 NULL 2 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # # MDEV-5991: crash in Item_field::used_tables @@ -7253,13 +7253,13 @@ insert into t1 values (3), (1), (7); create table t2 (b int, index idx(b)); insert into t2 values (2), (5), (3), (2); explain select * from t1 where (select max(b) from t2) = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away drop table t1,t2; # # MDEV-19429: Wrong query result with EXISTS and LIMIT 0 @@ -7271,9 +7271,9 @@ insert into t12 values (1),(2),(3); select * from t10 where exists (select * from t12 order by a limit 0); a explain select * from t10 where exists (select * from t12 order by a limit 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Zero limit +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Zero limit prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)"; set @l=1; execute stmt1 using @l; diff --git a/mysql-test/main/subselect_no_opts.result b/mysql-test/main/subselect_no_opts.result index 8ff79c1790b..59118365a1d 100644 --- a/mysql-test/main/subselect_no_opts.result +++ b/mysql-test/main/subselect_no_opts.result @@ -14,8 +14,8 @@ select (select 2); (select 2) 2 explain extended select (select 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 select 2 AS `(select 2)` @@ -24,10 +24,10 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2); 1 2 explain extended SELECT (SELECT 1) UNION SELECT (SELECT 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1249 Select 2 was reduced during optimization Note 1249 Select 4 was reduced during optimization @@ -36,11 +36,11 @@ SELECT (SELECT (SELECT 0 UNION SELECT 0)); (SELECT (SELECT 0 UNION SELECT 0)) 0 explain extended SELECT (SELECT (SELECT 0 UNION SELECT 0)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 /* select#1 */ select (/* select#3 */ select 0 union /* select#4 */ select 0) AS `(SELECT (SELECT 0 UNION SELECT 0))` @@ -54,10 +54,10 @@ SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a; SELECT (SELECT a) as a; ERROR 42S22: Reference 'a' not supported (forward reference in item list) EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00 -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 1 100.00 +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 @@ -196,12 +196,12 @@ a b 4 8 3 8 explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using filesort -3 UNION t4 ALL NULL NULL NULL NULL 3 100.00 Using where -4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort +3 UNION t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +4 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (/* select#3 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (/* select#4 */ select max(`test`.`t2`.`a`) * 4 from `test`.`t2`)) select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2; @@ -216,10 +216,10 @@ set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from (select * from t2 where a>1) as tt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (/* select#3 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt` set optimizer_switch=@tmp_optimizer_switch; @@ -237,10 +237,10 @@ b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) 8 4.5000 9 7.5000 explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,(/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` @@ -285,9 +285,9 @@ a 6 7 explain extended select * from t3 where a >= any (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2); @@ -325,11 +325,11 @@ select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) NULL 1 2 2 explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 -3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 +3 DEPENDENT UNION t5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 @@ -346,9 +346,9 @@ patient_uq clinic_uq 1 2 2 2 explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t6 ALL NULL NULL NULL NULL 4 100.00 Using where -2 DEPENDENT SUBQUERY t7 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t6 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +2 DEPENDENT SUBQUERY t7 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index Warnings: Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <in_optimizer>(`test`.`t6`.`clinic_uq`,<exists>(<primary_index_lookup>(<cache>(`test`.`t6`.`clinic_uq`) in t7 on PRIMARY))) @@ -380,11 +380,11 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce','test'); INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1'); INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1'); EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index -4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index -2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 -3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index +4 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index +2 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 +3 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index Warnings: Note 1003 /* select#1 */ select 'joce' AS `pseudo`,(/* select#2 */ select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1 SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM @@ -409,14 +409,14 @@ KEY `topic` (`topic`) INSERT INTO t1 (topic,date,pseudo) VALUES ('43506','2002-10-02','joce'),('40143','2002-08-03','joce'); EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03' EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 NULL index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; @@ -433,11 +433,11 @@ SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1; SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1; ERROR 21000: Subquery returns more than 1 row EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL topic 3 NULL 2 100.00 Using index -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL topic 3 NULL 2 100.00 Using index +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 drop table t1; @@ -562,14 +562,14 @@ ERROR 21000: Subquery returns more than 1 row SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1'); ERROR 21000: Subquery returns more than 1 row EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1' EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 /* select#1 */ select 3 AS `numreponse` from `test`.`t1` where 1 drop table t1; @@ -740,8 +740,8 @@ SELECT * FROM t2 WHERE id IN (SELECT 1); id 1 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref id id 5 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref id id 5 const 1 100.00 Using index Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1 @@ -752,18 +752,18 @@ SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1)); id 2 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref id id 5 const 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref id id 5 const 1 100.00 Using where; Using index Warnings: Note 1249 Select 3 was reduced during optimization Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = <cache>(1 + 1) EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL id 5 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(/* select#2 */ select 1 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(1) union /* select#3 */ select 3 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); @@ -886,8 +886,8 @@ select 10.5 > ANY (SELECT * from t1); 10.5 > ANY (SELECT * from t1) 1 explain extended select (select a+1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization @@ -909,9 +909,9 @@ a t1.a in (select t2.a from t2) 3 1 4 0 explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +2 SUBQUERY t2 NULL index_subquery a a 5 func 2 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` CREATE TABLE t3 (a int(11) default '0'); @@ -923,10 +923,10 @@ a t1.a in (select t2.a from t2,t3 where t3.a=t2.a) 3 1 4 0 explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL ref_or_null a a 5 func 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null)) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` drop table t1,t2,t3; @@ -1163,21 +1163,21 @@ i drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1269,10 +1269,10 @@ create table t1 (a int); insert into t1 values (1), (2), (3); explain extended select a,(select (select rand() from t1 limit 1) from t1 limit 1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 -3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 UNCACHEABLE SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +3 UNCACHEABLE SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,(/* select#2 */ select (/* select#3 */ select rand() from `test`.`t1` limit 1) from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1` drop table t1; @@ -1324,9 +1324,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) 0 EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 /* select#1 */ select <in_optimizer>(0,<exists>(/* select#2 */ select 1 from dual where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); @@ -1334,9 +1334,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) 0 EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 /* select#1 */ select <in_optimizer>(0,<exists>(/* select#2 */ select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; @@ -1379,9 +1379,9 @@ drop table t1; create table t1 (id int not null auto_increment primary key, salary int, key(salary)); insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000); explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref salary salary 5 const 1 100.00 Using where +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (/* select#2 */ select max(`test`.`t1`.`salary`) from `test`.`t1`) drop table t1; @@ -1441,9 +1441,9 @@ a 3 4 explain extended select * from t2 where t2.a in (select a from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY))) select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1451,9 +1451,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on PRIMARY where `test`.`t1`.`b` <> 30 and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))) select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1461,10 +1461,10 @@ a 2 3 explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where -2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t1`.`b` and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)) drop table t1, t2, t3; @@ -1484,9 +1484,9 @@ a 3 4 explain extended select * from t2 where t2.a in (select a from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL a 5 NULL 4 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 5 func 1001 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a))) select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1494,9 +1494,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL a 5 NULL 4 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 5 func 1001 100.00 Using index; Using where Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where `test`.`t1`.`b` <> 30 and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))) select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1504,10 +1504,10 @@ a 2 3 explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 ref a a 10 func,test.t3.a 1167 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL a 5 NULL 4 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index a a 5 NULL 3 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL ref a a 10 func,test.t3.a 1167 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`a` and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)) insert into t1 values (3,31); @@ -1521,9 +1521,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL a 5 NULL 4 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 5 func 1001 100.00 Using index; Using where Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where `test`.`t1`.`b` <> 30 and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))) drop table t0, t1, t2, t3; @@ -1579,8 +1579,8 @@ select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' fr s1 tttt explain extended (select * from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 (select 'tttt' AS `s1` from dual) (select * from t1); @@ -1612,27 +1612,27 @@ a1 0 a2 1 a3 1 explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; @@ -1645,17 +1645,17 @@ a 7 3 explain extended select * from t3 where a >= all (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); a explain extended select * from t3 where a >= some (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1664,49 +1664,49 @@ a 7 3 explain extended select * from t3 where a >= all (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); a explain extended select * from t3 where a >= some (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); a explain extended select * from t3 where NULL >= any (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= any (select b from t2 group by 1); a explain extended select * from t3 where NULL >= any (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= some (select b from t2); a explain extended select * from t3 where NULL >= some (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= some (select b from t2 group by 1); a explain extended select * from t3 where NULL >= some (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 insert into t2 values (2,2), (2,1), (3,3), (3,1); @@ -1715,9 +1715,9 @@ a 6 7 explain extended select * from t3 where a > all (select max(b) from t2 group by a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,<max>(/* select#2 */ select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))) drop table t2, t3; @@ -1764,11 +1764,11 @@ select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1); s1 e explain extended select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 -3 UNION t1 system NULL NULL NULL NULL 1 100.00 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 +3 UNION t1 NULL system NULL NULL NULL NULL 1 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 'e' AS `s1` from dual where 1 drop table t1; @@ -1885,15 +1885,15 @@ id text 11 text11 12 text12 explain extended select * from t1 where id not in (select id from t1 where id < 8); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where -2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 12 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and <cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`)))) explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where -2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY tt NULL ALL NULL NULL NULL NULL 12 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null limit 1)) @@ -1917,19 +1917,19 @@ id text id text id text 1000 text1000 NULL NULL 1000 text1000 1001 text1001 NULL NULL 1000 text1000 explain extended select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE a ALL NULL NULL NULL NULL 14 100.00 -1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 -1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a NULL ALL NULL NULL NULL NULL 14 100.00 +1 SIMPLE b NULL eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 +1 SIMPLE c NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition Warnings: Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id` drop table t1,t2; create table t1 (a int); insert into t1 values (1); explain select benchmark(1000, (select a from t1 where a=sha(rand()))); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 1 drop table t1; create table t1(id int); create table t2(id int); @@ -2427,9 +2427,9 @@ a b 1 2 3 4 explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY up NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <in_optimizer>(`test`.`up`.`a`,<exists>(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` where <cache>(`test`.`up`.`a`) = `test`.`t1`.`a`)) @@ -2602,16 +2602,16 @@ create table t1 (a int not null, b int not null, c int, primary key (a,b)); insert into t1 values (1,1,1), (2,2,2), (3,3,3); set @b:= 0; explain select sum(a) from t1 where b > @b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 3 Using where; Using index set @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where drop table t1; connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection root; @@ -2975,21 +2975,21 @@ one two test 10 5 NULL 10 10 NULL explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0') as 'test' from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(/* select#2 */ select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null))) AS `test` from `test`.`t1` explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(/* select#2 */ select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = 'N' and <cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` and <cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`)) explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(/* select#2 */ select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null))) AS `test` from `test`.`t1` DROP TABLE t1,t2; @@ -3111,10 +3111,10 @@ test.t1 analyze status OK explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 -1 PRIMARY r const PRIMARY PRIMARY 4 const 1 -2 SUBQUERY t2 range b b 40 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 +1 PRIMARY r NULL const PRIMARY PRIMARY 4 const 1 +2 SUBQUERY t2 NULL range b b 40 NULL 3 Using where SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; @@ -3123,10 +3123,10 @@ a a b explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 -1 PRIMARY r const PRIMARY PRIMARY 4 const 1 -2 SUBQUERY t2 range b b 40 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 +1 PRIMARY r NULL const PRIMARY PRIMARY 4 const 1 +2 SUBQUERY t2 NULL range b b 40 NULL 3 Using index condition SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; @@ -3175,9 +3175,9 @@ INSERT INTO t1 VALUES (NULL); CREATE TABLE t2(a int); INSERT INTO t2 VALUES (1),(2),(3); EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -2 SUBQUERY t1 index_subquery a a 5 func 3 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +2 SUBQUERY t1 NULL index_subquery a a 5 func 3 Using index; Full scan on NULL key SELECT a, a IN (SELECT a FROM t1) FROM t2; a a IN (SELECT a FROM t1) 1 1 @@ -3210,9 +3210,9 @@ a 1 2 EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE DROP TABLE t1; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (2), (4), (1), (3); @@ -3575,9 +3575,9 @@ CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 9 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 9 Using temporary ALTER TABLE t1 ADD INDEX(a); SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); a b @@ -3586,9 +3586,9 @@ CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where -2 DEPENDENT SUBQUERY t1 index NULL a 8 NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 9 Using where +2 DEPENDENT SUBQUERY t1 NULL index NULL a 8 NULL 1 DROP TABLE t1; create table t1( f1 int,f2 int); insert into t1 values (1,1),(2,2); @@ -3708,10 +3708,10 @@ SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 ORDER BY t1.t DESC LIMIT 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index -2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t1 NULL index NULL PRIMARY 13 NULL 11 Using where; Using index +2 SUBQUERY t1 NULL range PRIMARY PRIMARY 13 NULL 6 Using where; Using index SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 @@ -3733,18 +3733,18 @@ WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1))); i explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12)) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b)); insert into t1 (a) values (FLOOR(rand() * 100)); @@ -4212,9 +4212,9 @@ DROP TABLE t1,t2; CREATE TABLE t1 (a int, b int, KEY (a)); INSERT INTO t1 VALUES (1,1),(2,1); EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref a a 5 const 1 Using where; Using index -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref a a 5 const 1 Using where; Using index +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort DROP TABLE t1; CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); INSERT INTO t1 VALUES @@ -4250,9 +4250,9 @@ CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1), (2); EXPLAIN EXTENDED SELECT * FROM (SELECT count(*) FROM t1 GROUP BY a) as res; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `res`.`count(*)` AS `count(*)` from (/* select#2 */ select count(0) AS `count(*)` from `test`.`t1` group by `test`.`t1`.`a`) `res` DROP TABLE t1; @@ -4386,9 +4386,9 @@ a b CREATE INDEX I1 ON t1 (a); CREATE INDEX I2 ON t1 (b); EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 2 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t1 NULL index_subquery I1 I1 2 func 2 Using index; Using where SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1); a b CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10)); @@ -4396,16 +4396,16 @@ INSERT INTO t2 SELECT * FROM t1; CREATE INDEX I1 ON t2 (a); CREATE INDEX I2 ON t2 (b); EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 index_subquery I1 I1 4 func 2 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL index_subquery I1 I1 4 func 2 Using index; Using where SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2); a b EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 2 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t1 NULL index_subquery I1 I1 2 func 2 Using index; Using where SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500); a b DROP TABLE t1,t2; @@ -4425,9 +4425,9 @@ EXPLAIN SELECT a AS out_a, MIN(b) FROM t1 t1_outer WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_outer ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer NULL ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 4 Using where SELECT a AS out_a, MIN(b) FROM t1 t1_outer WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) GROUP BY a; @@ -4445,20 +4445,20 @@ SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a)); 2 EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` where <cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`)) EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION (SELECT 1 FROM t2 WHERE t1.a = t2.a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 @@ -4538,15 +4538,15 @@ INSERT INTO t1 VALUES (1),(2); SET @save_join_cache_level=@@join_cache_level; SET join_cache_level=0; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 0 SET join_cache_level=@save_join_cache_level; @@ -4569,8 +4569,8 @@ int_nokey int_key 5 5 0 0 EXPLAIN EXTENDED SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE C ALL NULL NULL NULL NULL 20 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE C NULL ALL NULL NULL NULL NULL 20 100.00 Using where DROP TABLE C; # End of test for bug#45061. # @@ -4591,9 +4591,9 @@ EXPLAIN SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; @@ -4613,10 +4613,10 @@ EXPLAIN SELECT * FROM t2 outr WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) ORDER BY outr.pk; -id select_type table type possible_keys key key_len ref rows Extra -x x outr ALL x x x x x x -x x t1 eq_ref x x x x x x -x x t2 index x x x x x x +id select_type table partitions type possible_keys key key_len ref rows Extra +x x outr x ALL x x x x x x +x x t1 x eq_ref x x x x x x +x x t2 x index x x x x x x # should not crash on debug binaries SELECT * FROM t2 outr WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) @@ -4635,9 +4635,9 @@ SELECT @@session.sql_mode INTO @old_sql_mode; SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1); @@ -4983,10 +4983,10 @@ KEY b_2 (b) INSERT INTO t3 VALUES (1,1,1), (2,32,1), (3,33,1), (4,34,2); explain SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 Using index -1 PRIMARY t3 ref b,b_2 b 5 test.t1.a 1 Using index -2 DEPENDENT SUBQUERY t2 ref b,b_2,c b 10 test.t3.c,test.t1.a 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 Using index +1 PRIMARY t3 NULL ref b,b_2 b 5 test.t1.a 1 Using index +2 DEPENDENT SUBQUERY t2 NULL ref b,b_2,c b 10 test.t3.c,test.t1.a 1 Using where; Using index SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a; a incorrect 1 1 @@ -5681,11 +5681,11 @@ a a explain SELECT * FROM ot1,ot4 WHERE (ot1.a,ot4.a) IN (SELECT it2.a,it3.a FROM it2,it3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot1 ALL NULL NULL NULL NULL 2 -1 PRIMARY ot4 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY it2 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY it3 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY ot4 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY it2 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY it3 NULL ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) DROP TABLE IF EXISTS ot1, ot4, it2, it3; # # Bug#729039: NULL keys used to evaluate subquery @@ -5701,9 +5701,9 @@ a EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 USE INDEX() WHERE t2.a = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a); a @@ -5711,9 +5711,9 @@ a EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t2 index_subquery idx idx 5 func 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t2 NULL index_subquery idx idx 5 func 2 Using index DROP TABLE t1,t2; # # BUG#752992: Wrong results for a subquery with 'semijoin=on' @@ -5729,10 +5729,10 @@ INSERT INTO t2 VALUES (15,4); SET @save_join_cache_level=@@join_cache_level; SET join_cache_level=0; EXPLAIN SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -2 DEPENDENT SUBQUERY it eq_ref PRIMARY PRIMARY 4 func 1 Using index -2 DEPENDENT SUBQUERY t2 index NULL PRIMARY 4 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +2 DEPENDENT SUBQUERY it NULL eq_ref PRIMARY PRIMARY 4 func 1 Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL PRIMARY 4 NULL 3 Using index SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1); pk i 11 0 @@ -5752,9 +5752,9 @@ EXPLAIN SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; @@ -5995,12 +5995,12 @@ drop view v1; CREATE TABLE t1 (a INT, b INT, INDEX (a)); INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20); EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 5 const 1 EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 SUBQUERY t1 ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 SUBQUERY t1 NULL ref a a 5 const 1 Using index DROP TABLE t1; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6015,10 +6015,10 @@ EXPLAIN SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2 WHERE EXISTS (SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY table1 ALL NULL NULL NULL NULL 2 -1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 Using where; Using index SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2 WHERE EXISTS (SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1); @@ -6071,9 +6071,9 @@ EXPLAIN SELECT col_int_nokey FROM ot WHERE col_varchar_nokey IN (SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY it1 index_subquery idx_cvk_cik idx_cvk_cik 9 func,const 2 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY it1 NULL index_subquery idx_cvk_cik idx_cvk_cik 9 func,const 2 Using index; Using where SELECT col_int_nokey FROM ot WHERE col_varchar_nokey IN (SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL); @@ -6083,9 +6083,9 @@ EXPLAIN SELECT col_int_nokey FROM ot WHERE (col_varchar_nokey, 'x') IN (SELECT col_varchar_key, col_varchar_key2 FROM it2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY it2 index_subquery idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 func,const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY it2 NULL index_subquery idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 func,const 1 Using index; Using where SELECT col_int_nokey FROM ot WHERE (col_varchar_nokey, 'x') IN (SELECT col_varchar_key, col_varchar_key2 FROM it2); @@ -6129,8 +6129,8 @@ EXPLAIN SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE sq4_alias1 NULL system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6143,9 +6143,9 @@ EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found -2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 0 Const row not found +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6166,9 +6166,9 @@ c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 FROM t2 AS c_sq1_alias1 WHERE (c_sq1_alias1.col_int_nokey != @var2 OR c_sq1_alias1.pk != @var3)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 SELECT sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) @@ -6188,9 +6188,9 @@ c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 FROM t2 AS c_sq1_alias1 WHERE (c_sq1_alias1.col_int_nokey != @var2 OR c_sq1_alias1.pk != @var3)) ) AS alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 SELECT * FROM ( SELECT sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) @@ -6239,10 +6239,10 @@ EXPLAIN SELECT t2.b , t1.c FROM t2 LEFT JOIN t1 ON t1.c < 3 WHERE (t2.b , t1.c) NOT IN (SELECT * from t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t2.b , t1.c FROM t2 LEFT JOIN t1 ON t1.c < 3 WHERE (t2.b, t1.c) NOT IN (SELECT * from t3); @@ -6261,15 +6261,15 @@ INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20); set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED t1 ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED t1 NULL ref a a 5 const 1 set optimizer_switch=@tmp_optimizer_switch; EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 SUBQUERY t1 ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 SUBQUERY t1 NULL ref a a 5 const 1 Using index DROP TABLE t1; # @@ -6398,10 +6398,10 @@ WHERE EXISTS SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY table1 ALL NULL NULL NULL NULL 2 -1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 Using where; Using index DROP TABLE t1,t2; # # lp:826279: assertion failure with GROUP BY a result of subquery @@ -6627,18 +6627,18 @@ INSERT INTO t1 VALUES ('2009-01-01'),('2009-02-02'); set @old_optimizer_switch = @@optimizer_switch; SET @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index -2 DEPENDENT SUBQUERY t1 index_subquery a a 4 func 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 4 func 2 Using index SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); a 2009-01-01 2009-02-02 SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index -2 MATERIALIZED t1 index NULL a 4 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 Using where; Using index +2 MATERIALIZED t1 NULL index NULL a 4 NULL 2 Using index SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); a 2009-01-01 @@ -6689,33 +6689,33 @@ CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; INSERT INTO t2 VALUES (3,'f'); EXPLAIN SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 NULL EXPLAIN SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 0 EXPLAIN SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 1 EXPLAIN SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 0 @@ -6729,12 +6729,12 @@ INSERT INTO t1 VALUES (7),(0); CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; f1 f2 drop table t1,t2; @@ -6746,20 +6746,20 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(7); EXPLAIN SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1; min_a a EXPLAIN SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT UNION t1 NULL ALL NULL NULL NULL NULL 2 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1; min_a a drop table t1; @@ -6818,9 +6818,9 @@ SELECT MAX( alias2.a ) AS field FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR alias1.a = 'y' HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible HAVING -2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 Using index; Using where SELECT MAX( alias2.a ) AS field FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR alias1.a = 'y' @@ -6830,11 +6830,11 @@ EXPLAIN SELECT MAX( alias2.a ) FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index -1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index -1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join) -2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL index a a 19 NULL 11 Using where; Using index +1 PRIMARY alias2 NULL ref a a 19 test.alias1.a 2 Using index +1 PRIMARY alias3 NULL index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 Using index; Using where SELECT MAX( alias2.a ) FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 ); @@ -6852,12 +6852,12 @@ INSERT INTO t2 VALUES (1),(7); EXPLAIN SELECT * FROM t1 WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2)); a1 @@ -6876,13 +6876,13 @@ set @@expensive_subquery_limit= 0; EXPLAIN SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 flush status; SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; @@ -6914,13 +6914,13 @@ set @@expensive_subquery_limit= default; EXPLAIN SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 flush status; SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; @@ -6958,10 +6958,10 @@ CREATE TABLE t2 (b INT PRIMARY KEY); INSERT INTO t2 VALUES (1),(2); EXPLAIN SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1)); a drop table t1,t2; @@ -6980,11 +6980,11 @@ insert into t4 select * from t3; explain SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1 WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL b NULL NULL NULL 2 Using where -1 PRIMARY t3 ref d d 5 test.t2.b 2 Using index -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL b NULL NULL NULL 2 Using where +1 PRIMARY t3 NULL ref d d 5 test.t2.b 2 Using index +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away set @tmp_mdev410=@@global.userstat; set global userstat=on; flush table_statistics; @@ -7012,10 +7012,10 @@ INSERT INTO t1 VALUES (1),(8); CREATE TABLE t2 (b INT, KEY(b)); INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index -2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL range a a 5 NULL 2 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # # MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields @@ -7029,11 +7029,11 @@ INSERT INTO t3 VALUES ('b'),('c'); EXPLAIN SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index -2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index a a 5 NULL 2 Using where; Using index +2 SUBQUERY <subquery3> NULL ALL distinct_key NULL NULL NULL 1 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; a @@ -7046,10 +7046,10 @@ INSERT INTO t1 VALUES (1),(8); CREATE TABLE t2 (b INT, KEY(b)); INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index -2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL range a a 5 NULL 2 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # # MDEV-5991: crash in Item_field::used_tables @@ -7251,13 +7251,13 @@ insert into t1 values (3), (1), (7); create table t2 (b int, index idx(b)); insert into t2 values (2), (5), (3), (2); explain select * from t1 where (select max(b) from t2) = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away drop table t1,t2; # # MDEV-19429: Wrong query result with EXISTS and LIMIT 0 @@ -7269,9 +7269,9 @@ insert into t12 values (1),(2),(3); select * from t10 where exists (select * from t12 order by a limit 0); a explain select * from t10 where exists (select * from t12 order by a limit 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Zero limit +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Zero limit prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)"; set @l=1; execute stmt1 using @l; diff --git a/mysql-test/main/subselect_no_scache.result b/mysql-test/main/subselect_no_scache.result index 37ca0d4c030..8fe088858e7 100644 --- a/mysql-test/main/subselect_no_scache.result +++ b/mysql-test/main/subselect_no_scache.result @@ -17,8 +17,8 @@ select (select 2); (select 2) 2 explain extended select (select 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 select 2 AS `(select 2)` @@ -27,10 +27,10 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2); 1 2 explain extended SELECT (SELECT 1) UNION SELECT (SELECT 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1249 Select 2 was reduced during optimization Note 1249 Select 4 was reduced during optimization @@ -39,11 +39,11 @@ SELECT (SELECT (SELECT 0 UNION SELECT 0)); (SELECT (SELECT 0 UNION SELECT 0)) 0 explain extended SELECT (SELECT (SELECT 0 UNION SELECT 0)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 /* select#1 */ select (/* select#3 */ select 0 union /* select#4 */ select 0) AS `(SELECT (SELECT 0 UNION SELECT 0))` @@ -57,10 +57,10 @@ SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a; SELECT (SELECT a) as a; ERROR 42S22: Reference 'a' not supported (forward reference in item list) EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00 -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 1 100.00 +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 @@ -199,12 +199,12 @@ a b 4 8 3 8 explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using filesort -3 UNION t4 ALL NULL NULL NULL NULL 3 100.00 Using where -4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort +3 UNION t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +4 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (/* select#3 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (/* select#4 */ select max(`test`.`t2`.`a`) * 4 from `test`.`t2`)) select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2; @@ -219,10 +219,10 @@ set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from (select * from t2 where a>1) as tt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (/* select#3 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt` set optimizer_switch=@tmp_optimizer_switch; @@ -240,10 +240,10 @@ b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) 8 4.5000 9 7.5000 explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,(/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` @@ -288,9 +288,9 @@ a 6 7 explain extended select * from t3 where a >= any (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2); @@ -328,11 +328,11 @@ select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) NULL 1 2 2 explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 -3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 +3 DEPENDENT UNION t5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 @@ -349,9 +349,9 @@ patient_uq clinic_uq 1 2 2 2 explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index -1 PRIMARY t6 ALL i1 NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t7 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +1 PRIMARY t6 NULL ALL i1 NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq` @@ -383,11 +383,11 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce','test'); INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1'); INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1'); EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index -4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index -2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 -3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index +4 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index +2 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 +3 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index Warnings: Note 1003 /* select#1 */ select 'joce' AS `pseudo`,(/* select#2 */ select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1 SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM @@ -412,14 +412,14 @@ KEY `topic` (`topic`) INSERT INTO t1 (topic,date,pseudo) VALUES ('43506','2002-10-02','joce'),('40143','2002-08-03','joce'); EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03' EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 NULL index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; @@ -436,11 +436,11 @@ SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1; SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1; ERROR 21000: Subquery returns more than 1 row EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL topic 3 NULL 2 100.00 Using index -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL topic 3 NULL 2 100.00 Using index +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 drop table t1; @@ -565,14 +565,14 @@ ERROR 21000: Subquery returns more than 1 row SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1'); ERROR 21000: Subquery returns more than 1 row EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1' EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 /* select#1 */ select 3 AS `numreponse` from `test`.`t1` where 1 drop table t1; @@ -743,8 +743,8 @@ SELECT * FROM t2 WHERE id IN (SELECT 1); id 1 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref id id 5 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref id id 5 const 1 100.00 Using index Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1 @@ -755,18 +755,18 @@ SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1)); id 2 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref id id 5 const 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref id id 5 const 1 100.00 Using where; Using index Warnings: Note 1249 Select 3 was reduced during optimization Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = <cache>(1 + 1) EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL id 5 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`id` AS `id` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`id`,<exists>(/* select#2 */ select 1 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(1) union /* select#3 */ select 3 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(3))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); @@ -889,8 +889,8 @@ select 10.5 > ANY (SELECT * from t1); 10.5 > ANY (SELECT * from t1) 1 explain extended select (select a+1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization @@ -912,9 +912,9 @@ a t1.a in (select t2.a from t2) 3 1 4 0 explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +2 SUBQUERY t2 NULL index_subquery a a 5 func 2 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having `test`.`t2`.`a` is null))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` CREATE TABLE t3 (a int(11) default '0'); @@ -926,10 +926,10 @@ a t1.a in (select t2.a from t2,t3 where t3.a=t2.a) 3 1 4 0 explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL ref_or_null a a 5 func 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a` or `test`.`t2`.`a` is null) having `test`.`t2`.`a` is null)) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` drop table t1,t2,t3; @@ -1166,21 +1166,21 @@ i drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1272,10 +1272,10 @@ create table t1 (a int); insert into t1 values (1), (2), (3); explain extended select a,(select (select rand() from t1 limit 1) from t1 limit 1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 -3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 UNCACHEABLE SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +3 UNCACHEABLE SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,(/* select#2 */ select (/* select#3 */ select rand() from `test`.`t1` limit 1) from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1` drop table t1; @@ -1327,9 +1327,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) 0 EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 /* select#1 */ select <in_optimizer>(0,<exists>(/* select#2 */ select 1 from dual where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); @@ -1337,9 +1337,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) 0 EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 /* select#1 */ select <in_optimizer>(0,<exists>(/* select#2 */ select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; @@ -1382,9 +1382,9 @@ drop table t1; create table t1 (id int not null auto_increment primary key, salary int, key(salary)); insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000); explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref salary salary 5 const 1 100.00 Using where +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (/* select#2 */ select max(`test`.`t1`.`salary`) from `test`.`t1`) drop table t1; @@ -1444,9 +1444,9 @@ a 3 4 explain extended select * from t2 where t2.a in (select a from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1454,9 +1454,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1464,10 +1464,10 @@ a 2 3 explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 -1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 +1 PRIMARY t3 NULL index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a` drop table t1, t2, t3; @@ -1487,9 +1487,9 @@ a 3 4 explain extended select * from t2 where t2.a in (select a from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1497,9 +1497,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1507,10 +1507,10 @@ a 2 3 explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t3 range a a 5 NULL 3 100.00 Using where; Using index -1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t3 NULL range a a 5 NULL 3 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where `test`.`t1`.`b` = `test`.`t3`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a` insert into t1 values (3,31); @@ -1524,9 +1524,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index -1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 4 100.00 Using where; Using index +1 PRIMARY t1 NULL ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 drop table t0, t1, t2, t3; @@ -1582,8 +1582,8 @@ select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' fr s1 tttt explain extended (select * from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 (select 'tttt' AS `s1` from dual) (select * from t1); @@ -1615,27 +1615,27 @@ a1 0 a2 1 a3 1 explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 SUBQUERY t2 NULL index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; @@ -1648,17 +1648,17 @@ a 7 3 explain extended select * from t3 where a >= all (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); a explain extended select * from t3 where a >= some (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1667,49 +1667,49 @@ a 7 3 explain extended select * from t3 where a >= all (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); a explain extended select * from t3 where a >= some (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); a explain extended select * from t3 where NULL >= any (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= any (select b from t2 group by 1); a explain extended select * from t3 where NULL >= any (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= some (select b from t2); a explain extended select * from t3 where NULL >= some (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= some (select b from t2 group by 1); a explain extended select * from t3 where NULL >= some (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 insert into t2 values (2,2), (2,1), (3,3), (3,1); @@ -1718,9 +1718,9 @@ a 6 7 explain extended select * from t3 where a > all (select max(b) from t2 group by a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,<max>(/* select#2 */ select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))) drop table t2, t3; @@ -1767,11 +1767,11 @@ select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1); s1 e explain extended select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 -3 UNION t1 system NULL NULL NULL NULL 1 100.00 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 +3 UNION t1 NULL system NULL NULL NULL NULL 1 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 'e' AS `s1` from dual where 1 drop table t1; @@ -1888,15 +1888,15 @@ id text 11 text11 12 text12 explain extended select * from t1 where id not in (select id from t1 where id < 8); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where -2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 12 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where `test`.`t1`.`id` < 8 and <cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`)))) explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where -2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY tt NULL ALL NULL NULL NULL NULL 12 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null limit 1)) @@ -1920,19 +1920,19 @@ id text id text id text 1000 text1000 NULL NULL 1000 text1000 1001 text1001 NULL NULL 1000 text1000 explain extended select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE a ALL NULL NULL NULL NULL 14 100.00 -1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 -1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a NULL ALL NULL NULL NULL NULL 14 100.00 +1 SIMPLE b NULL eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 +1 SIMPLE c NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition Warnings: Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id` drop table t1,t2; create table t1 (a int); insert into t1 values (1); explain select benchmark(1000, (select a from t1 where a=sha(rand()))); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 1 drop table t1; create table t1(id int); create table t2(id int); @@ -2430,10 +2430,10 @@ a b 1 2 3 4 explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY up NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` semi join (`test`.`t1`) where 1 @@ -2606,16 +2606,16 @@ create table t1 (a int not null, b int not null, c int, primary key (a,b)); insert into t1 values (1,1,1), (2,2,2), (3,3,3); set @b:= 0; explain select sum(a) from t1 where b > @b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 3 Using where; Using index set @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where drop table t1; connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection root; @@ -2979,22 +2979,22 @@ one two test 10 5 NULL 10 10 NULL explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0') as 'test' from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(/* select#2 */ select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null))) AS `test` from `test`.`t1` explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`flag` = 'N' explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(/* select#2 */ select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' and trigcond(trigcond(<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one` or `test`.`t2`.`one` is null)) and trigcond(trigcond(<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two` or `test`.`t2`.`two` is null)) having trigcond(`test`.`t2`.`one` is null) and trigcond(`test`.`t2`.`two` is null))) AS `test` from `test`.`t1` DROP TABLE t1,t2; @@ -3116,10 +3116,10 @@ test.t1 analyze status OK explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 -1 PRIMARY r const PRIMARY PRIMARY 4 const 1 -2 SUBQUERY t2 range b b 40 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 +1 PRIMARY r NULL const PRIMARY PRIMARY 4 const 1 +2 SUBQUERY t2 NULL range b b 40 NULL 3 Using where SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; @@ -3128,10 +3128,10 @@ a a b explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 -1 PRIMARY r const PRIMARY PRIMARY 4 const 1 -2 SUBQUERY t2 range b b 40 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 +1 PRIMARY r NULL const PRIMARY PRIMARY 4 const 1 +2 SUBQUERY t2 NULL range b b 40 NULL 3 Using index condition SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; @@ -3180,9 +3180,9 @@ INSERT INTO t1 VALUES (NULL); CREATE TABLE t2(a int); INSERT INTO t2 VALUES (1),(2),(3); EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -2 SUBQUERY t1 index_subquery a a 5 func 3 Using index; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +2 SUBQUERY t1 NULL index_subquery a a 5 func 3 Using index; Full scan on NULL key SELECT a, a IN (SELECT a FROM t1) FROM t2; a a IN (SELECT a FROM t1) 1 1 @@ -3215,9 +3215,9 @@ a 1 2 EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE DROP TABLE t1; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (2), (4), (1), (3); @@ -3580,10 +3580,10 @@ CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 9 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 Using temporary ALTER TABLE t1 ADD INDEX(a); SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); a b @@ -3592,10 +3592,10 @@ CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL a NULL NULL NULL 9 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 9 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL a NULL NULL NULL 9 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 Using temporary DROP TABLE t1; create table t1( f1 int,f2 int); insert into t1 values (1,1),(2,2); @@ -3715,10 +3715,10 @@ SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 ORDER BY t1.t DESC LIMIT 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index -2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t1 NULL index NULL PRIMARY 13 NULL 11 Using where; Using index +2 SUBQUERY t1 NULL range PRIMARY PRIMARY 13 NULL 6 Using where; Using index SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 @@ -3740,18 +3740,18 @@ WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1))); i explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12)) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b)); insert into t1 (a) values (FLOOR(rand() * 100)); @@ -4219,9 +4219,9 @@ DROP TABLE t1,t2; CREATE TABLE t1 (a int, b int, KEY (a)); INSERT INTO t1 VALUES (1,1),(2,1); EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref a a 5 const 1 Using where; Using index -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref a a 5 const 1 Using where; Using index +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort DROP TABLE t1; CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); INSERT INTO t1 VALUES @@ -4257,9 +4257,9 @@ CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1), (2); EXPLAIN EXTENDED SELECT * FROM (SELECT count(*) FROM t1 GROUP BY a) as res; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `res`.`count(*)` AS `count(*)` from (/* select#2 */ select count(0) AS `count(*)` from `test`.`t1` group by `test`.`t1`.`a`) `res` DROP TABLE t1; @@ -4393,9 +4393,9 @@ a b CREATE INDEX I1 ON t1 (a); CREATE INDEX I2 ON t1 (b); EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL I2 NULL NULL NULL 2 Using where -1 PRIMARY t1 ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1); a b CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10)); @@ -4403,16 +4403,16 @@ INSERT INTO t2 SELECT * FROM t1; CREATE INDEX I1 ON t2 (a); CREATE INDEX I2 ON t2 (b); EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL I2 NULL NULL NULL 2 Using where -1 PRIMARY t2 ref I1 I1 4 test.t2.b 2 Using where; Using index; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL I2 NULL NULL NULL 2 Using where +1 PRIMARY t2 NULL ref I1 I1 4 test.t2.b 2 Using where; Using index; FirstMatch(t2) SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2); a b EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL I2 NULL NULL NULL 2 Using where -1 PRIMARY t1 ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1) SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500); a b DROP TABLE t1,t2; @@ -4432,9 +4432,9 @@ EXPLAIN SELECT a AS out_a, MIN(b) FROM t1 t1_outer WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_outer ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer NULL ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 4 Using where SELECT a AS out_a, MIN(b) FROM t1 t1_outer WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) GROUP BY a; @@ -4452,21 +4452,21 @@ SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a)); 2 EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 select 2 AS `2` from `test`.`t1` semi join (`test`.`t2`) where 1 EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION (SELECT 1 FROM t2 WHERE t1.a = t2.a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 @@ -4546,17 +4546,17 @@ INSERT INTO t1 VALUES (1),(2); SET @save_join_cache_level=@@join_cache_level; SET join_cache_level=0; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL const distinct_key distinct_key 4 const 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select 1 AS `1` from <materialize> (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1 EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL const distinct_key distinct_key 4 const 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary Warnings: Note 1003 /* select#1 */ select 1 AS `1` from <materialize> (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` where `test`.`t1`.`a` > 3 group by `test`.`t1`.`a`) join `test`.`t1` where `<subquery2>`.`min(a)` = 1 SET join_cache_level=@save_join_cache_level; @@ -4579,8 +4579,8 @@ int_nokey int_key 5 5 0 0 EXPLAIN EXTENDED SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE C ALL NULL NULL NULL NULL 20 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE C NULL ALL NULL NULL NULL NULL 20 100.00 Using where DROP TABLE C; # End of test for bug#45061. # @@ -4601,9 +4601,9 @@ EXPLAIN SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; @@ -4623,10 +4623,10 @@ EXPLAIN SELECT * FROM t2 outr WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) ORDER BY outr.pk; -id select_type table type possible_keys key key_len ref rows Extra -x x outr ALL x x x x x x -x x t1 eq_ref x x x x x x -x x t2 index x x x x x x +id select_type table partitions type possible_keys key key_len ref rows Extra +x x outr x ALL x x x x x x +x x t1 x eq_ref x x x x x x +x x t2 x index x x x x x x # should not crash on debug binaries SELECT * FROM t2 outr WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) @@ -4645,9 +4645,9 @@ SELECT @@session.sql_mode INTO @old_sql_mode; SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1); @@ -4993,10 +4993,10 @@ KEY b_2 (b) INSERT INTO t3 VALUES (1,1,1), (2,32,1), (3,33,1), (4,34,2); explain SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 Using index -1 PRIMARY t3 ref b,b_2 b 5 test.t1.a 1 Using index -2 DEPENDENT SUBQUERY t2 ref b,b_2,c b 10 test.t3.c,test.t1.a 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 Using index +1 PRIMARY t3 NULL ref b,b_2 b 5 test.t1.a 1 Using index +2 DEPENDENT SUBQUERY t2 NULL ref b,b_2,c b 10 test.t3.c,test.t1.a 1 Using where; Using index SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a; a incorrect 1 1 @@ -5691,12 +5691,12 @@ a a explain SELECT * FROM ot1,ot4 WHERE (ot1.a,ot4.a) IN (SELECT it2.a,it3.a FROM it2,it3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot1 ALL NULL NULL NULL NULL 2 -1 PRIMARY ot4 ALL NULL NULL NULL NULL 8 Using join buffer (flat, BNL join) -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -2 MATERIALIZED it2 ALL NULL NULL NULL NULL 4 -2 MATERIALIZED it3 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY ot4 NULL ALL NULL NULL NULL NULL 8 Using join buffer (flat, BNL join) +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED it2 NULL ALL NULL NULL NULL NULL 4 +2 MATERIALIZED it3 NULL ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) DROP TABLE IF EXISTS ot1, ot4, it2, it3; # # Bug#729039: NULL keys used to evaluate subquery @@ -5712,10 +5712,10 @@ a EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 USE INDEX() WHERE t2.a = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a); a @@ -5723,10 +5723,10 @@ a EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 index idx idx 5 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL index idx idx 5 NULL 3 Using index DROP TABLE t1,t2; # # BUG#752992: Wrong results for a subquery with 'semijoin=on' @@ -5742,10 +5742,10 @@ INSERT INTO t2 VALUES (15,4); SET @save_join_cache_level=@@join_cache_level; SET join_cache_level=0; EXPLAIN SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 3 -1 PRIMARY it eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 Using index -1 PRIMARY t2 index NULL PRIMARY 4 NULL 3 Using index; FirstMatch(it) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 3 +1 PRIMARY it NULL eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 Using index +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 3 Using index; FirstMatch(it) SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1); pk i 11 0 @@ -5765,9 +5765,9 @@ EXPLAIN SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; @@ -6008,12 +6008,12 @@ drop view v1; CREATE TABLE t1 (a INT, b INT, INDEX (a)); INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20); EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 5 const 1 EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 SUBQUERY t1 ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 SUBQUERY t1 NULL ref a a 5 const 1 Using index DROP TABLE t1; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6028,10 +6028,10 @@ EXPLAIN SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2 WHERE EXISTS (SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY table1 ALL NULL NULL NULL NULL 2 -1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 Using where; Using index SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2 WHERE EXISTS (SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1); @@ -6084,10 +6084,10 @@ EXPLAIN SELECT col_int_nokey FROM ot WHERE col_varchar_nokey IN (SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot system NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it1 ref idx_cvk_cik idx_cvk_cik 9 const,const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it1 NULL ref idx_cvk_cik idx_cvk_cik 9 const,const 1 Using where; Using index SELECT col_int_nokey FROM ot WHERE col_varchar_nokey IN (SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL); @@ -6097,10 +6097,10 @@ EXPLAIN SELECT col_int_nokey FROM ot WHERE (col_varchar_nokey, 'x') IN (SELECT col_varchar_key, col_varchar_key2 FROM it2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot system NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -2 MATERIALIZED it2 ref idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 const,const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED it2 NULL ref idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 const,const 1 Using where; Using index SELECT col_int_nokey FROM ot WHERE (col_varchar_nokey, 'x') IN (SELECT col_varchar_key, col_varchar_key2 FROM it2); @@ -6144,8 +6144,8 @@ EXPLAIN SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE sq4_alias1 NULL system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6158,9 +6158,9 @@ EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found -2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 0 Const row not found +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6181,9 +6181,9 @@ c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 FROM t2 AS c_sq1_alias1 WHERE (c_sq1_alias1.col_int_nokey != @var2 OR c_sq1_alias1.pk != @var3)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 SELECT sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) @@ -6203,9 +6203,9 @@ c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 FROM t2 AS c_sq1_alias1 WHERE (c_sq1_alias1.col_int_nokey != @var2 OR c_sq1_alias1.pk != @var3)) ) AS alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 SELECT * FROM ( SELECT sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) @@ -6254,10 +6254,10 @@ EXPLAIN SELECT t2.b , t1.c FROM t2 LEFT JOIN t1 ON t1.c < 3 WHERE (t2.b , t1.c) NOT IN (SELECT * from t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t2.b , t1.c FROM t2 LEFT JOIN t1 ON t1.c < 3 WHERE (t2.b, t1.c) NOT IN (SELECT * from t3); @@ -6276,15 +6276,15 @@ INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20); set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED t1 ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED t1 NULL ref a a 5 const 1 set optimizer_switch=@tmp_optimizer_switch; EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 SUBQUERY t1 ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 SUBQUERY t1 NULL ref a a 5 const 1 Using index DROP TABLE t1; # @@ -6413,10 +6413,10 @@ WHERE EXISTS SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY table1 ALL NULL NULL NULL NULL 2 -1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 Using where; Using index DROP TABLE t1,t2; # # lp:826279: assertion failure with GROUP BY a result of subquery @@ -6642,18 +6642,18 @@ INSERT INTO t1 VALUES ('2009-01-01'),('2009-02-02'); set @old_optimizer_switch = @@optimizer_switch; SET @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index -2 DEPENDENT SUBQUERY t1 index_subquery a a 4 func 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 4 func 2 Using index SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); a 2009-01-01 2009-02-02 SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index -2 MATERIALIZED t1 index NULL a 4 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 Using where; Using index +2 MATERIALIZED t1 NULL index NULL a 4 NULL 2 Using index SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); a 2009-01-01 @@ -6704,33 +6704,33 @@ CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; INSERT INTO t2 VALUES (3,'f'); EXPLAIN SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 NULL EXPLAIN SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 0 EXPLAIN SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 1 EXPLAIN SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 0 @@ -6744,12 +6744,12 @@ INSERT INTO t1 VALUES (7),(0); CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; f1 f2 drop table t1,t2; @@ -6761,20 +6761,20 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(7); EXPLAIN SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1; min_a a EXPLAIN SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT UNION t1 NULL ALL NULL NULL NULL NULL 2 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1; min_a a drop table t1; @@ -6833,9 +6833,9 @@ SELECT MAX( alias2.a ) AS field FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR alias1.a = 'y' HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible HAVING -2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 Using index; Using where SELECT MAX( alias2.a ) AS field FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR alias1.a = 'y' @@ -6845,11 +6845,11 @@ EXPLAIN SELECT MAX( alias2.a ) FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index -1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index -1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join) -2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL index a a 19 NULL 11 Using where; Using index +1 PRIMARY alias2 NULL ref a a 19 test.alias1.a 2 Using index +1 PRIMARY alias3 NULL index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 Using index; Using where SELECT MAX( alias2.a ) FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 ); @@ -6867,12 +6867,12 @@ INSERT INTO t2 VALUES (1),(7); EXPLAIN SELECT * FROM t1 WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2)); a1 @@ -6891,13 +6891,13 @@ set @@expensive_subquery_limit= 0; EXPLAIN SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 flush status; SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; @@ -6929,13 +6929,13 @@ set @@expensive_subquery_limit= default; EXPLAIN SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 flush status; SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; @@ -6973,10 +6973,10 @@ CREATE TABLE t2 (b INT PRIMARY KEY); INSERT INTO t2 VALUES (1),(2); EXPLAIN SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1)); a drop table t1,t2; @@ -6995,11 +6995,11 @@ insert into t4 select * from t3; explain SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1 WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL b NULL NULL NULL 2 Using where -1 PRIMARY t3 ref d d 5 test.t2.b 2 Using index -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL b NULL NULL NULL 2 Using where +1 PRIMARY t3 NULL ref d d 5 test.t2.b 2 Using index +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away set @tmp_mdev410=@@global.userstat; set global userstat=on; flush table_statistics; @@ -7027,10 +7027,10 @@ INSERT INTO t1 VALUES (1),(8); CREATE TABLE t2 (b INT, KEY(b)); INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index -2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL range a a 5 NULL 2 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # # MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields @@ -7044,11 +7044,11 @@ INSERT INTO t3 VALUES ('b'),('c'); EXPLAIN SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index -2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index a a 5 NULL 2 Using where; Using index +2 SUBQUERY <subquery3> NULL ALL distinct_key NULL NULL NULL 1 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; a @@ -7061,10 +7061,10 @@ INSERT INTO t1 VALUES (1),(8); CREATE TABLE t2 (b INT, KEY(b)); INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index -2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL range a a 5 NULL 2 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # # MDEV-5991: crash in Item_field::used_tables @@ -7266,13 +7266,13 @@ insert into t1 values (3), (1), (7); create table t2 (b int, index idx(b)); insert into t2 values (2), (5), (3), (2); explain select * from t1 where (select max(b) from t2) = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away drop table t1,t2; # # MDEV-19429: Wrong query result with EXISTS and LIMIT 0 @@ -7284,9 +7284,9 @@ insert into t12 values (1),(2),(3); select * from t10 where exists (select * from t12 order by a limit 0); a explain select * from t10 where exists (select * from t12 order by a limit 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Zero limit +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Zero limit prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)"; set @l=1; execute stmt1 using @l; diff --git a/mysql-test/main/subselect_no_semijoin.result b/mysql-test/main/subselect_no_semijoin.result index d4aad3e1d32..aa19495d265 100644 --- a/mysql-test/main/subselect_no_semijoin.result +++ b/mysql-test/main/subselect_no_semijoin.result @@ -14,8 +14,8 @@ select (select 2); (select 2) 2 explain extended select (select 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 select 2 AS `(select 2)` @@ -24,10 +24,10 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2); 1 2 explain extended SELECT (SELECT 1) UNION SELECT (SELECT 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1249 Select 2 was reduced during optimization Note 1249 Select 4 was reduced during optimization @@ -36,11 +36,11 @@ SELECT (SELECT (SELECT 0 UNION SELECT 0)); (SELECT (SELECT 0 UNION SELECT 0)) 0 explain extended SELECT (SELECT (SELECT 0 UNION SELECT 0)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 /* select#1 */ select (/* select#3 */ select 0 union /* select#4 */ select 0) AS `(SELECT (SELECT 0 UNION SELECT 0))` @@ -54,10 +54,10 @@ SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a; SELECT (SELECT a) as a; ERROR 42S22: Reference 'a' not supported (forward reference in item list) EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00 -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 1 100.00 +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1 @@ -196,12 +196,12 @@ a b 4 8 3 8 explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using filesort -3 UNION t4 ALL NULL NULL NULL NULL 3 100.00 Using where -4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort +3 UNION t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +4 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = (/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1)) union (/* select#3 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where `test`.`t4`.`b` = (/* select#4 */ select max(`test`.`t2`.`a`) * 4 from `test`.`t2`)) select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2; @@ -216,10 +216,10 @@ set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from (select * from t2 where a>1) as tt; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`a` < 8 order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (/* select#3 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`a` > 1) `tt` set optimizer_switch=@tmp_optimizer_switch; @@ -237,10 +237,10 @@ b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) 8 4.5000 9 7.5000 explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((/* select#2 */ select avg(`test`.`t2`.`a` + (/* select#3 */ select min(`test`.`t3`.`a`) from `test`.`t3` where `test`.`t3`.`a` >= `test`.`t4`.`a`)) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4` @@ -285,9 +285,9 @@ a 6 7 explain extended select * from t3 where a >= any (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2); @@ -325,11 +325,11 @@ select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) NULL 1 2 2 explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 -3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 +3 DEPENDENT UNION t5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1 @@ -346,9 +346,9 @@ patient_uq clinic_uq 1 2 2 2 explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t6 ALL NULL NULL NULL NULL 4 100.00 Using where -2 MATERIALIZED t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t6 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +2 MATERIALIZED t7 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index Warnings: Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(<in_optimizer>(`test`.`t6`.`clinic_uq`,`test`.`t6`.`clinic_uq` in ( <materialize> (/* select#2 */ select `test`.`t7`.`uq` from `test`.`t7` where 1 ), <primary_index_lookup>(`test`.`t6`.`clinic_uq` in <temporary table> on distinct_key where `test`.`t6`.`clinic_uq` = `<subquery2>`.`uq`)))) @@ -380,11 +380,11 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce','test'); INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1'); INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1'); EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index -4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index -2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 -3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index +4 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index +2 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 +3 SUBQUERY t8 NULL const PRIMARY PRIMARY 37 const 1 100.00 Using index Warnings: Note 1003 /* select#1 */ select 'joce' AS `pseudo`,(/* select#2 */ select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1 SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM @@ -409,14 +409,14 @@ KEY `topic` (`topic`) INSERT INTO t1 (topic,date,pseudo) VALUES ('43506','2002-10-02','joce'),('40143','2002-08-03','joce'); EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03' EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 NULL index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select distinct `test`.`t1`.`date` from `test`.`t1` where `test`.`t1`.`date` = DATE'2002-08-03') AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; @@ -433,11 +433,11 @@ SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1; SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1; ERROR 21000: Subquery returns more than 1 row EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL topic 3 NULL 2 100.00 Using index -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL topic 3 NULL 2 100.00 Using index +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 drop table t1; @@ -562,14 +562,14 @@ ERROR 21000: Subquery returns more than 1 row SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1'); ERROR 21000: Subquery returns more than 1 row EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where `test`.`t1`.`numeropost` = '1' EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 /* select#1 */ select 3 AS `numreponse` from `test`.`t1` where 1 drop table t1; @@ -740,8 +740,8 @@ SELECT * FROM t2 WHERE id IN (SELECT 1); id 1 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref id id 5 const 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref id id 5 const 1 100.00 Using index Warnings: Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = 1 @@ -752,18 +752,18 @@ SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1)); id 2 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ref id id 5 const 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref id id 5 const 1 100.00 Using where; Using index Warnings: Note 1249 Select 3 was reduced during optimization Note 1249 Select 2 was reduced during optimization Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where `test`.`t2`.`id` = <cache>(1 + 1) EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL id 5 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`id` AS `id` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(/* select#2 */ select 1 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(1) union /* select#3 */ select 3 having <cache>(`test`.`t2`.`id`) = <ref_null_helper>(3)))) SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3); @@ -886,8 +886,8 @@ select 10.5 > ANY (SELECT * from t1); 10.5 > ANY (SELECT * from t1) 1 explain extended select (select a+1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1249 Select 2 was reduced during optimization @@ -909,9 +909,9 @@ a t1.a in (select t2.a from t2) 3 1 4 0 explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -2 MATERIALIZED t2 index a a 5 NULL 3 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +2 MATERIALIZED t2 NULL index a a 5 NULL 3 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`a`)))) AS `t1.a in (select t2.a from t2)` from `test`.`t1` CREATE TABLE t3 (a int(11) default '0'); @@ -923,10 +923,10 @@ a t1.a in (select t2.a from t2,t3 where t3.a=t2.a) 3 1 4 0 explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index -2 MATERIALIZED t2 index a a 5 NULL 3 100.00 Using index -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +2 MATERIALIZED t2 NULL index a a 5 NULL 3 100.00 Using index +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a` ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`a`)))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1` drop table t1,t2,t3; @@ -1163,21 +1163,21 @@ i drop table t1; CREATE TABLE t1 (a int(1)); EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select (/* select#2 */ select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1` drop table t1; @@ -1269,10 +1269,10 @@ create table t1 (a int); insert into t1 values (1), (2), (3); explain extended select a,(select (select rand() from t1 limit 1) from t1 limit 1) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 -3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 UNCACHEABLE SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +3 UNCACHEABLE SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,(/* select#2 */ select (/* select#3 */ select rand() from `test`.`t1` limit 1) from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1` drop table t1; @@ -1324,9 +1324,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) 0 EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 /* select#1 */ select <in_optimizer>(0,<exists>(/* select#2 */ select 1 from dual where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); @@ -1334,9 +1334,9 @@ SELECT 0 IN (SELECT 1 FROM t1 a); 0 IN (SELECT 1 FROM t1 a) 0 EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 /* select#1 */ select <in_optimizer>(0,<exists>(/* select#2 */ select 1 from `test`.`t1` `a` where 0 = 1)) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; @@ -1379,9 +1379,9 @@ drop table t1; create table t1 (id int not null auto_increment primary key, salary int, key(salary)); insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000); explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref salary salary 5 const 1 100.00 Using where +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`salary` = (/* select#2 */ select max(`test`.`t1`.`salary`) from `test`.`t1`) drop table t1; @@ -1441,9 +1441,9 @@ a 3 4 explain extended select * from t2 where t2.a in (select a from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index -2 MATERIALIZED t1 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index +2 MATERIALIZED t1 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where `test`.`t2`.`a` = `<subquery2>`.`a`)))) select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1451,9 +1451,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index -2 MATERIALIZED t1 ALL PRIMARY NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index +2 MATERIALIZED t1 NULL ALL PRIMARY NULL NULL NULL 4 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` where `test`.`t1`.`b` <> 30 ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where `test`.`t2`.`a` = `<subquery2>`.`a`)))) select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1461,10 +1461,10 @@ a 2 3 explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index -2 MATERIALIZED t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using index -2 MATERIALIZED t1 ALL PRIMARY NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 4 100.00 Using where; Using index +2 MATERIALIZED t3 NULL index PRIMARY PRIMARY 4 NULL 3 100.00 Using index +2 MATERIALIZED t1 NULL ALL PRIMARY NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,`test`.`t2`.`a` in ( <materialize> (/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`a` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where `test`.`t2`.`a` = `<subquery2>`.`a`)))) drop table t1, t2, t3; @@ -1484,9 +1484,9 @@ a 3 4 explain extended select * from t2 where t2.a in (select a from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL a 5 NULL 4 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 5 func 1001 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a)))) select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1494,9 +1494,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL a 5 NULL 4 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 5 func 1001 100.00 Using index; Using where Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where `test`.`t1`.`b` <> 30 and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))) select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1504,10 +1504,10 @@ a 2 3 explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 ref a a 10 func,test.t3.a 1167 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL a 5 NULL 4 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index a a 5 NULL 3 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL ref a a 10 func,test.t3.a 1167 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` join `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`a` and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))) insert into t1 values (3,31); @@ -1521,9 +1521,9 @@ a 2 4 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL a 5 NULL 4 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 5 func 1001 100.00 Using index; Using where Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <expr_cache><`test`.`t2`.`a`>(<in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where `test`.`t1`.`b` <> 30 and <cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))) drop table t0, t1, t2, t3; @@ -1579,8 +1579,8 @@ select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' fr s1 tttt explain extended (select * from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 (select 'tttt' AS `s1` from dual) (select * from t1); @@ -1612,27 +1612,27 @@ a1 0 a2 1 a3 1 explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 MATERIALIZED t2 index s1 s1 6 NULL 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 MATERIALIZED t2 NULL index s1 s1 6 NULL 2 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (/* select#2 */ select `test`.`t2`.`s1` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where `test`.`t1`.`s1` = `<subquery2>`.`s1`)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 MATERIALIZED t2 index s1 s1 6 NULL 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 MATERIALIZED t2 NULL index s1 s1 6 NULL 2 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (/* select#2 */ select `test`.`t2`.`s1` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where `test`.`t1`.`s1` = `<subquery2>`.`s1`)))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 MATERIALIZED t2 index s1 s1 6 NULL 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 MATERIALIZED t2 NULL index s1 s1 6 NULL 2 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (/* select#2 */ select `test`.`t2`.`s1` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where `test`.`t1`.`s1` = `<subquery2>`.`s1`)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1` explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 MATERIALIZED t2 range s1 s1 6 NULL 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL s1 6 NULL 3 100.00 Using index +2 MATERIALIZED t2 NULL range s1 s1 6 NULL 1 100.00 Using where; Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,`test`.`t1`.`s1` in ( <materialize> (/* select#2 */ select `test`.`t2`.`s1` from `test`.`t2` where `test`.`t2`.`s1` < 'a2' ), <primary_index_lookup>(`test`.`t1`.`s1` in <temporary table> on distinct_key where `test`.`t1`.`s1` = `<subquery2>`.`s1`)))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; @@ -1645,17 +1645,17 @@ a 7 3 explain extended select * from t3 where a >= all (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2); a explain extended select * from t3 where a >= some (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where a >= all (select b from t2 group by 1); @@ -1664,49 +1664,49 @@ a 7 3 explain extended select * from t3 where a >= all (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))) select * from t3 where a >= some (select b from t2 group by 1); a explain extended select * from t3 where a >= some (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,(/* select#2 */ select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))) select * from t3 where NULL >= any (select b from t2); a explain extended select * from t3 where NULL >= any (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= any (select b from t2 group by 1); a explain extended select * from t3 where NULL >= any (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= some (select b from t2); a explain extended select * from t3 where NULL >= some (select b from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 select * from t3 where NULL >= some (select b from t2 group by 1); a explain extended select * from t3 where NULL >= some (select b from t2 group by 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0 insert into t2 values (2,2), (2,1), (3,3), (3,1); @@ -1715,9 +1715,9 @@ a 6 7 explain extended select * from t3 where a > all (select max(b) from t2 group by a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where -2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,<max>(/* select#2 */ select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))) drop table t2, t3; @@ -1764,11 +1764,11 @@ select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1); s1 e explain extended select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 -2 SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 -3 UNION t1 system NULL NULL NULL NULL 1 100.00 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 +3 UNION t1 NULL system NULL NULL NULL NULL 1 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 'e' AS `s1` from dual where 1 drop table t1; @@ -1885,15 +1885,15 @@ id text 11 text11 12 text12 explain extended select * from t1 where id not in (select id from t1 where id < 8); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where -2 MATERIALIZED t1 range PRIMARY PRIMARY 4 NULL 7 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 12 100.00 Using where +2 MATERIALIZED t1 NULL range PRIMARY PRIMARY 4 NULL 7 100.00 Using where; Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where !<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,`test`.`t1`.`id` in ( <materialize> (/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 ), <primary_index_lookup>(`test`.`t1`.`id` in <temporary table> on distinct_key where `test`.`t1`.`id` = `<subquery2>`.`id`)))) explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where -2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY tt NULL ALL NULL NULL NULL NULL 12 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null limit 1))) @@ -1917,19 +1917,19 @@ id text id text id text 1000 text1000 NULL NULL 1000 text1000 1001 text1001 NULL NULL 1000 text1000 explain extended select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE a ALL NULL NULL NULL NULL 14 100.00 -1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 -1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a NULL ALL NULL NULL NULL NULL 14 100.00 +1 SIMPLE b NULL eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00 +1 SIMPLE c NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition Warnings: Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(`test`.`b`.`id` = `test`.`a`.`id` or `test`.`b`.`id` is null) join `test`.`t1` `c` where if(`test`.`b`.`id` is null,1000,`test`.`b`.`id`) = `test`.`c`.`id` drop table t1,t2; create table t1 (a int); insert into t1 values (1); explain select benchmark(1000, (select a from t1 where a=sha(rand()))); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 1 drop table t1; create table t1(id int); create table t2(id int); @@ -2427,9 +2427,9 @@ a b 1 2 3 4 explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00 Using where -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY up NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(<in_optimizer>(`test`.`up`.`a`,`test`.`up`.`a` in ( <materialize> (/* select#2 */ select `test`.`t1`.`a` from `test`.`t1` where 1 ), <primary_index_lookup>(`test`.`up`.`a` in <temporary table> on distinct_key where `test`.`up`.`a` = `<subquery2>`.`a`)))) @@ -2602,16 +2602,16 @@ create table t1 (a int not null, b int not null, c int, primary key (a,b)); insert into t1 values (1,1,1), (2,2,2), (3,3,3); set @b:= 0; explain select sum(a) from t1 where b > @b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 3 Using where; Using index set @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where drop table t1; connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection root; @@ -2975,21 +2975,21 @@ one two test 10 5 NULL 10 10 NULL explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0') as 'test' from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (/* select#2 */ select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where `test`.`t1`.`one` = `<subquery2>`.`one` and `test`.`t1`.`two` = `<subquery2>`.`two`)))) AS `test` from `test`.`t1` explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (/* select#2 */ select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = 'N' ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where `test`.`t1`.`one` = `<subquery2>`.`one` and `test`.`t1`.`two` = `<subquery2>`.`two`)))) explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),(`test`.`t1`.`one`,`test`.`t1`.`two`) in ( <materialize> (/* select#2 */ select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where `test`.`t2`.`flag` = '0' ), <primary_index_lookup>(`test`.`t1`.`one` in <temporary table> on distinct_key where `test`.`t1`.`one` = `<subquery2>`.`one` and `test`.`t1`.`two` = `<subquery2>`.`two`)))) AS `test` from `test`.`t1` DROP TABLE t1,t2; @@ -3111,10 +3111,10 @@ test.t1 analyze status OK explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 -1 PRIMARY r const PRIMARY PRIMARY 4 const 1 -2 SUBQUERY t2 range b b 40 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 +1 PRIMARY r NULL const PRIMARY PRIMARY 4 const 1 +2 SUBQUERY t2 NULL range b b 40 NULL 3 Using where SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; @@ -3123,10 +3123,10 @@ a a b explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 -1 PRIMARY r const PRIMARY PRIMARY 4 const 1 -2 SUBQUERY t2 range b b 40 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 +1 PRIMARY r NULL const PRIMARY PRIMARY 4 const 1 +2 SUBQUERY t2 NULL range b b 40 NULL 3 Using index condition SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; @@ -3175,9 +3175,9 @@ INSERT INTO t1 VALUES (NULL); CREATE TABLE t2(a int); INSERT INTO t2 VALUES (1),(2),(3); EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 -2 MATERIALIZED t1 index a a 5 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 +2 MATERIALIZED t1 NULL index a a 5 NULL 5 Using index SELECT a, a IN (SELECT a FROM t1) FROM t2; a a IN (SELECT a FROM t1) 1 1 @@ -3210,9 +3210,9 @@ a 1 2 EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE DROP TABLE t1; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (2), (4), (1), (3); @@ -3575,9 +3575,9 @@ CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 9 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 9 Using where +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 Using temporary ALTER TABLE t1 ADD INDEX(a); SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); a b @@ -3586,9 +3586,9 @@ CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 9 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 9 Using where +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 Using temporary DROP TABLE t1; create table t1( f1 int,f2 int); insert into t1 values (1,1),(2,2); @@ -3708,10 +3708,10 @@ SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 ORDER BY t1.t DESC LIMIT 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index -2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t1 NULL index NULL PRIMARY 13 NULL 11 Using where; Using index +2 SUBQUERY t1 NULL range PRIMARY PRIMARY 13 NULL 6 Using where; Using index SELECT * FROM t1,t2 WHERE t1.t = (SELECT t1.t FROM t1 WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1 @@ -3733,18 +3733,18 @@ WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1))); i explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12)) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL explain select * from t1 where not exists ((select t11.i from t1 t11) union (select t12.i from t1 t12)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b)); insert into t1 (a) values (FLOOR(rand() * 100)); @@ -4212,9 +4212,9 @@ DROP TABLE t1,t2; CREATE TABLE t1 (a int, b int, KEY (a)); INSERT INTO t1 VALUES (1,1),(2,1); EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref a a 5 const 1 Using where; Using index -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref a a 5 const 1 Using where; Using index +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort DROP TABLE t1; CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); INSERT INTO t1 VALUES @@ -4250,9 +4250,9 @@ CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1), (2); EXPLAIN EXTENDED SELECT * FROM (SELECT count(*) FROM t1 GROUP BY a) as res; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort Warnings: Note 1003 /* select#1 */ select `res`.`count(*)` AS `count(*)` from (/* select#2 */ select count(0) AS `count(*)` from `test`.`t1` group by `test`.`t1`.`a`) `res` DROP TABLE t1; @@ -4386,9 +4386,9 @@ a b CREATE INDEX I1 ON t1 (a); CREATE INDEX I2 ON t1 (b); EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 2 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t1 NULL index_subquery I1 I1 2 func 2 Using index; Using where SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1); a b CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10)); @@ -4396,16 +4396,16 @@ INSERT INTO t2 SELECT * FROM t1; CREATE INDEX I1 ON t2 (a); CREATE INDEX I2 ON t2 (b); EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 index_subquery I1 I1 4 func 2 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL index_subquery I1 I1 4 func 2 Using index; Using where SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2); a b EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 2 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t1 NULL index_subquery I1 I1 2 func 2 Using index; Using where SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500); a b DROP TABLE t1,t2; @@ -4425,9 +4425,9 @@ EXPLAIN SELECT a AS out_a, MIN(b) FROM t1 t1_outer WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_outer ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_outer NULL ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 4 Using where SELECT a AS out_a, MIN(b) FROM t1 t1_outer WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a) GROUP BY a; @@ -4445,20 +4445,20 @@ SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a)); 2 EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`a` from `test`.`t2` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`a`)))) EXPLAIN EXTENDED SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION (SELECT 1 FROM t2 WHERE t1.a = t2.a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 2 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 @@ -4538,15 +4538,15 @@ INSERT INTO t1 VALUES (1),(2); SET @save_join_cache_level=@@join_cache_level; SET join_cache_level=0; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 0 SET join_cache_level=@save_join_cache_level; @@ -4569,8 +4569,8 @@ int_nokey int_key 5 5 0 0 EXPLAIN EXTENDED SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE C ALL NULL NULL NULL NULL 20 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE C NULL ALL NULL NULL NULL NULL 20 100.00 Using where DROP TABLE C; # End of test for bug#45061. # @@ -4591,9 +4591,9 @@ EXPLAIN SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; @@ -4613,10 +4613,10 @@ EXPLAIN SELECT * FROM t2 outr WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) ORDER BY outr.pk; -id select_type table type possible_keys key key_len ref rows Extra -x x outr ALL x x x x x x -x x t1 index x x x x x x -x x t2 index x x x x x x +id select_type table partitions type possible_keys key key_len ref rows Extra +x x outr x ALL x x x x x x +x x t1 x index x x x x x x +x x t2 x index x x x x x x # should not crash on debug binaries SELECT * FROM t2 outr WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) @@ -4635,9 +4635,9 @@ SELECT @@session.sql_mode INTO @old_sql_mode; SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 /* select#1 */ select 1 AS `1` from `test`.`t1` where 1 SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1); @@ -4983,10 +4983,10 @@ KEY b_2 (b) INSERT INTO t3 VALUES (1,1,1), (2,32,1), (3,33,1), (4,34,2); explain SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 Using index -1 PRIMARY t3 ref b,b_2 b 5 test.t1.a 1 Using index -2 DEPENDENT SUBQUERY t2 ref b,b_2,c b 10 test.t3.c,test.t1.a 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 Using index +1 PRIMARY t3 NULL ref b,b_2 b 5 test.t1.a 1 Using index +2 DEPENDENT SUBQUERY t2 NULL ref b,b_2,c b 10 test.t3.c,test.t1.a 1 Using where; Using index SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a; a incorrect 1 1 @@ -5681,11 +5681,11 @@ a a explain SELECT * FROM ot1,ot4 WHERE (ot1.a,ot4.a) IN (SELECT it2.a,it3.a FROM it2,it3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot1 ALL NULL NULL NULL NULL 2 -1 PRIMARY ot4 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED it2 ALL NULL NULL NULL NULL 4 -2 MATERIALIZED it3 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY ot4 NULL ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED it2 NULL ALL NULL NULL NULL NULL 4 +2 MATERIALIZED it3 NULL ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) DROP TABLE IF EXISTS ot1, ot4, it2, it3; # # Bug#729039: NULL keys used to evaluate subquery @@ -5701,9 +5701,9 @@ a EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 USE INDEX() WHERE t2.a = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a); a @@ -5711,9 +5711,9 @@ a EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where -2 MATERIALIZED t2 index idx idx 5 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where +2 MATERIALIZED t2 NULL index idx idx 5 NULL 3 Using index DROP TABLE t1,t2; # # BUG#752992: Wrong results for a subquery with 'semijoin=on' @@ -5729,10 +5729,10 @@ INSERT INTO t2 VALUES (15,4); SET @save_join_cache_level=@@join_cache_level; SET join_cache_level=0; EXPLAIN SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -2 MATERIALIZED t2 index NULL PRIMARY 4 NULL 3 Using index -2 MATERIALIZED it index PRIMARY PRIMARY 4 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +2 MATERIALIZED t2 NULL index NULL PRIMARY 4 NULL 3 Using index +2 MATERIALIZED it NULL index PRIMARY PRIMARY 4 NULL 3 Using index SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1); pk i 11 0 @@ -5752,9 +5752,9 @@ EXPLAIN SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; @@ -5995,12 +5995,12 @@ drop view v1; CREATE TABLE t1 (a INT, b INT, INDEX (a)); INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20); EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 5 const 1 EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 SUBQUERY t1 ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 SUBQUERY t1 NULL ref a a 5 const 1 Using index DROP TABLE t1; # # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) @@ -6015,10 +6015,10 @@ EXPLAIN SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2 WHERE EXISTS (SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY table1 ALL NULL NULL NULL NULL 2 -1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 Using where; Using index SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2 WHERE EXISTS (SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1); @@ -6071,9 +6071,9 @@ EXPLAIN SELECT col_int_nokey FROM ot WHERE col_varchar_nokey IN (SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY it1 index_subquery idx_cvk_cik idx_cvk_cik 9 func,const 2 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY it1 NULL index_subquery idx_cvk_cik idx_cvk_cik 9 func,const 2 Using index; Using where SELECT col_int_nokey FROM ot WHERE col_varchar_nokey IN (SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL); @@ -6083,9 +6083,9 @@ EXPLAIN SELECT col_int_nokey FROM ot WHERE (col_varchar_nokey, 'x') IN (SELECT col_varchar_key, col_varchar_key2 FROM it2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY it2 index_subquery idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 func,const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY it2 NULL index_subquery idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 func,const 1 Using index; Using where SELECT col_int_nokey FROM ot WHERE (col_varchar_nokey, 'x') IN (SELECT col_varchar_key, col_varchar_key2 FROM it2); @@ -6129,8 +6129,8 @@ EXPLAIN SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE sq4_alias1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE sq4_alias1 NULL system NULL NULL NULL NULL 0 Const row not found SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6143,9 +6143,9 @@ EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR sq4_alias1.col_varchar_key = @var3 ) AS alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found -2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 0 Const row not found +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR @@ -6166,9 +6166,9 @@ c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 FROM t2 AS c_sq1_alias1 WHERE (c_sq1_alias1.col_int_nokey != @var2 OR c_sq1_alias1.pk != @var3)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 SELECT sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) @@ -6188,9 +6188,9 @@ c_sq1_alias1.col_varchar_nokey AS c_sq1_field2 FROM t2 AS c_sq1_alias1 WHERE (c_sq1_alias1.col_int_nokey != @var2 OR c_sq1_alias1.pk != @var3)) ) AS alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 SELECT * FROM ( SELECT sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey) @@ -6239,10 +6239,10 @@ EXPLAIN SELECT t2.b , t1.c FROM t2 LEFT JOIN t1 ON t1.c < 3 WHERE (t2.b , t1.c) NOT IN (SELECT * from t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 SELECT t2.b , t1.c FROM t2 LEFT JOIN t1 ON t1.c < 3 WHERE (t2.b, t1.c) NOT IN (SELECT * from t3); @@ -6261,15 +6261,15 @@ INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20); set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED t1 ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED t1 NULL ref a a 5 const 1 set optimizer_switch=@tmp_optimizer_switch; EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 SUBQUERY t1 ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 SUBQUERY t1 NULL ref a a 5 const 1 Using index DROP TABLE t1; # @@ -6398,10 +6398,10 @@ WHERE EXISTS SELECT DISTINCT f1_key FROM t2 WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY table1 ALL NULL NULL NULL NULL 2 -1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 Using where; Using index DROP TABLE t1,t2; # # lp:826279: assertion failure with GROUP BY a result of subquery @@ -6627,18 +6627,18 @@ INSERT INTO t1 VALUES ('2009-01-01'),('2009-02-02'); set @old_optimizer_switch = @@optimizer_switch; SET @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index -2 DEPENDENT SUBQUERY t1 index_subquery a a 4 func 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 4 func 2 Using index SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); a 2009-01-01 2009-02-02 SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index -2 MATERIALIZED t1 index NULL a 4 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 Using where; Using index +2 MATERIALIZED t1 NULL index NULL a 4 NULL 2 Using index SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1); a 2009-01-01 @@ -6689,33 +6689,33 @@ CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; INSERT INTO t2 VALUES (3,'f'); EXPLAIN SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 NULL EXPLAIN SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 0 EXPLAIN SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 1 EXPLAIN SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; COUNT(f1) f4 0 0 @@ -6729,12 +6729,12 @@ INSERT INTO t1 VALUES (7),(0); CREATE TABLE t2 (b INT); EXPLAIN SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 0 Const row not found -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 0 Const row not found +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; f1 f2 drop table t1,t2; @@ -6746,20 +6746,20 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(7); EXPLAIN SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1; min_a a EXPLAIN SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT UNION t1 NULL ALL NULL NULL NULL NULL 2 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1; min_a a drop table t1; @@ -6818,9 +6818,9 @@ SELECT MAX( alias2.a ) AS field FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR alias1.a = 'y' HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible HAVING -2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 Using index; Using where SELECT MAX( alias2.a ) AS field FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR alias1.a = 'y' @@ -6830,11 +6830,11 @@ EXPLAIN SELECT MAX( alias2.a ) FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index -1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index -1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join) -2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL index a a 19 NULL 11 Using where; Using index +1 PRIMARY alias2 NULL ref a a 19 test.alias1.a 2 Using index +1 PRIMARY alias3 NULL index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 Using index; Using where SELECT MAX( alias2.a ) FROM t1 AS alias1, t1 AS alias2, t1 AS alias3 WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 ); @@ -6852,12 +6852,12 @@ INSERT INTO t2 VALUES (1),(7); EXPLAIN SELECT * FROM t1 WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2)); a1 @@ -6876,13 +6876,13 @@ set @@expensive_subquery_limit= 0; EXPLAIN SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 flush status; SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; @@ -6914,13 +6914,13 @@ set @@expensive_subquery_limit= default; EXPLAIN SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 -1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 flush status; SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) FROM t2 alias1, t1 alias2, t1 alias3; @@ -6958,10 +6958,10 @@ CREATE TABLE t2 (b INT PRIMARY KEY); INSERT INTO t2 VALUES (1),(2); EXPLAIN SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Select tables optimized away -3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1)); a drop table t1,t2; @@ -6980,11 +6980,11 @@ insert into t4 select * from t3; explain SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1 WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL b NULL NULL NULL 2 Using where -1 PRIMARY t3 ref d d 5 test.t2.b 2 Using index -3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ALL b NULL NULL NULL 2 Using where +1 PRIMARY t3 NULL ref d d 5 test.t2.b 2 Using index +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away set @tmp_mdev410=@@global.userstat; set global userstat=on; flush table_statistics; @@ -7012,10 +7012,10 @@ INSERT INTO t1 VALUES (1),(8); CREATE TABLE t2 (b INT, KEY(b)); INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index -2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL range a a 5 NULL 2 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # # MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields @@ -7029,11 +7029,11 @@ INSERT INTO t3 VALUES ('b'),('c'); EXPLAIN SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index -2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index a a 5 NULL 2 Using where; Using index +2 SUBQUERY <subquery3> NULL ALL distinct_key NULL NULL NULL 1 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; a @@ -7046,10 +7046,10 @@ INSERT INTO t1 VALUES (1),(8); CREATE TABLE t2 (b INT, KEY(b)); INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index -2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY t1 NULL range a a 5 NULL 2 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # # MDEV-5991: crash in Item_field::used_tables @@ -7251,13 +7251,13 @@ insert into t1 values (3), (1), (7); create table t2 (b int, index idx(b)); insert into t2 values (2), (5), (3), (2); explain select * from t1 where (select max(b) from t2) = 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away drop table t1,t2; # # MDEV-19429: Wrong query result with EXISTS and LIMIT 0 @@ -7269,9 +7269,9 @@ insert into t12 values (1),(2),(3); select * from t10 where exists (select * from t12 order by a limit 0); a explain select * from t10 where exists (select * from t12 order by a limit 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Zero limit +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Zero limit prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)"; set @l=1; execute stmt1 using @l; diff --git a/mysql-test/main/subselect_partial_match.result b/mysql-test/main/subselect_partial_match.result index 52c30492675..22ac530d8da 100644 --- a/mysql-test/main/subselect_partial_match.result +++ b/mysql-test/main/subselect_partial_match.result @@ -72,49 +72,49 @@ insert into t2 values ('o', 'z', 'p'); set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off'; EXPLAIN SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; a1 a2 a3 in_res c NULL a NULL EXPLAIN SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); a1 a2 a3 set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on'; EXPLAIN SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; a1 a2 a3 in_res c NULL a NULL EXPLAIN SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); a1 a2 a3 set @@optimizer_switch=@in_exists; EXPLAIN SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; a1 a2 a3 in_res c NULL a NULL EXPLAIN SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); a1 a2 a3 set @@optimizer_switch = @test_default_opt_switch; @@ -127,49 +127,49 @@ insert into t2 values (NULL, 'y', 'w'); set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off'; EXPLAIN SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; a1 a2 a3 in_res NULL y NULL NULL EXPLAIN SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); a1 a2 a3 set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on'; EXPLAIN SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; a1 a2 a3 in_res NULL y NULL NULL EXPLAIN SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); a1 a2 a3 set @@optimizer_switch=@in_exists; EXPLAIN SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; a1 a2 a3 in_res NULL y NULL NULL EXPLAIN SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); a1 a2 a3 set @@optimizer_switch = @test_default_opt_switch; @@ -186,49 +186,49 @@ insert into t2 values (NULL, 'z', 'y'); set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off'; EXPLAIN SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; a1 a2 a3 in_res NULL g NULL NULL EXPLAIN SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); a1 a2 a3 set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on'; EXPLAIN SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; a1 a2 a3 in_res NULL g NULL NULL EXPLAIN SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); a1 a2 a3 set @@optimizer_switch=@in_exists; EXPLAIN SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; a1 a2 a3 in_res NULL g NULL NULL EXPLAIN SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); a1 a2 a3 set @@optimizer_switch = @test_default_opt_switch; @@ -245,51 +245,51 @@ insert into t2 values (NULL, 'z', 'y'); set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off'; EXPLAIN SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; a1 a2 a3 in_res b g NULL 0 EXPLAIN SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); a1 a2 a3 b g NULL set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on'; EXPLAIN SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; a1 a2 a3 in_res b g NULL 0 EXPLAIN SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); a1 a2 a3 b g NULL set @@optimizer_switch=@in_exists; EXPLAIN SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1; a1 a2 a3 in_res b g NULL 0 EXPLAIN SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2); a1 a2 a3 b g NULL @@ -307,49 +307,49 @@ insert into t2 values ('x', 'w', 'z', NULL); set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off'; EXPLAIN SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; a1 a2 a3 a4 in_res a g x NULL NULL EXPLAIN SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); a1 a2 a3 a4 set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on'; EXPLAIN SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; a1 a2 a3 a4 in_res a g x NULL NULL EXPLAIN SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); a1 a2 a3 a4 set @@optimizer_switch=@in_exists; EXPLAIN SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; a1 a2 a3 a4 in_res a g x NULL NULL EXPLAIN SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); a1 a2 a3 a4 drop table t1, t2; @@ -371,51 +371,51 @@ insert into t2 values ('34', 'q', 'y', 'x'); set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off'; EXPLAIN SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 Using where SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; a1 a2 a3 a4 in_res 99 NULL j f 0 EXPLAIN SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 Using where SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); a1 a2 a3 a4 99 NULL j f set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on'; EXPLAIN SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 Using where SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; a1 a2 a3 a4 in_res 99 NULL j f 0 EXPLAIN SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 Using where SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); a1 a2 a3 a4 99 NULL j f set @@optimizer_switch=@in_exists; EXPLAIN SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 Using where SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; a1 a2 a3 a4 in_res 99 NULL j f 0 EXPLAIN SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 Using where SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); a1 a2 a3 a4 99 NULL j f @@ -469,52 +469,52 @@ insert into t2 values ('34', 'qq', 'y', 'x'); set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off'; EXPLAIN SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 35 Using where SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; a1 a2 a3 a4 in_res NULL 98 NULL b NULL NULL 99 NULL c NULL EXPLAIN SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 35 Using where SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); a1 a2 a3 a4 set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on'; EXPLAIN SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 35 Using where SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; a1 a2 a3 a4 in_res NULL 98 NULL b NULL NULL 99 NULL c NULL EXPLAIN SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 35 Using where SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); a1 a2 a3 a4 set @@optimizer_switch=@in_exists; EXPLAIN SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 35 Using where SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; a1 a2 a3 a4 in_res NULL 98 NULL b NULL NULL 99 NULL c NULL EXPLAIN SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 35 Using where SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); a1 a2 a3 a4 change the mathcing row to be the last one in the first bitmap word @@ -523,52 +523,52 @@ update t2 set b2 = NULL where b1 = 31; set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off'; EXPLAIN SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 35 Using where SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; a1 a2 a3 a4 in_res NULL 98 NULL b NULL NULL 99 NULL c NULL EXPLAIN SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 35 Using where SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); a1 a2 a3 a4 set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on'; EXPLAIN SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 35 Using where SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; a1 a2 a3 a4 in_res NULL 98 NULL b NULL NULL 99 NULL c NULL EXPLAIN SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 35 Using where SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); a1 a2 a3 a4 set @@optimizer_switch=@in_exists; EXPLAIN SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 35 Using where SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; a1 a2 a3 a4 in_res NULL 98 NULL b NULL NULL 99 NULL c NULL EXPLAIN SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 35 Using where SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2); a1 a2 a3 a4 drop table t1, t2; @@ -732,9 +732,9 @@ insert into t2 values ('03', 'qq', 'y', 'x'); set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off'; EXPLAIN SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 Using where SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1; a1 a2 a3 a4 in_res NULL 98 NULL b 0 @@ -770,10 +770,10 @@ set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; EXPLAIN EXTENDED SELECT * FROM (SELECT * FROM t1 WHERE a1 NOT IN (SELECT b2 FROM t2)) table1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using where -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 /* select#1 */ select `table1`.`a1` AS `a1`,`table1`.`a2` AS `a2` from (/* select#2 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where !(<in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (/* select#3 */ select `test`.`t2`.`b2` from `test`.`t2` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery3>`.`b2`))))) `table1` set optimizer_switch=@tmp_optimizer_switch; @@ -785,9 +785,9 @@ set @@optimizer_switch='materialization=on,semijoin=off,partial_match_rowid_merg create table t1 (a1 char(3) DEFAULT NULL, a2 char(3) DEFAULT NULL); insert into t1 values (NULL, 'a21'), (NULL, 'a22'); explain select * from t1 where (a1, a2) not in (select a1, a2 from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 select * from t1 where (a1, a2) not in (select a1, a2 from t1); a1 a2 drop table t1; @@ -819,10 +819,10 @@ FROM t1 WHERE (t1.d , t1.d) NOT IN ( SELECT t3.d , t2.c FROM t3 LEFT JOIN t2 ON t3.a = t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED t3 system NULL NULL NULL NULL 1 -2 MATERIALIZED t2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t3 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t2 NULL system NULL NULL NULL NULL 1 SELECT * FROM t1 WHERE (t1.d , t1.d) NOT IN ( @@ -836,10 +836,10 @@ FROM t1 WHERE (t1.d , t1.d) NOT IN ( SELECT t3.d , t2.c FROM t3 LEFT JOIN t2 ON t3.a = t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t3 NULL system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 SELECT * FROM t1 WHERE (t1.d , t1.d) NOT IN ( @@ -858,18 +858,18 @@ INSERT INTO t2 VALUES (6,3), (9,NULL); set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off'; EXPLAIN SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT b, a FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT b, a FROM t2); c 0 0 EXPLAIN SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT a, b FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT a, b FROM t2); c 0 @@ -877,18 +877,18 @@ c set @@optimizer_switch='materialization=off,in_to_exists=on'; EXPLAIN SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT b, a FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT b, a FROM t2); c 0 0 EXPLAIN SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT a, b FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT a, b FROM t2); c 0 @@ -903,17 +903,17 @@ CREATE TABLE t2 ( f3 int) ; INSERT INTO t2 VALUES (5); set @@optimizer_switch='in_to_exists=off,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off'; EXPLAIN SELECT * FROM t2 WHERE ( 3 , 1 ) NOT IN ( SELECT f1 , f2 FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 SELECT * FROM t2 WHERE ( 3 , 1 ) NOT IN ( SELECT f1 , f2 FROM t1 ); f3 5 set @@optimizer_switch='in_to_exists=on,materialization=off'; EXPLAIN SELECT * FROM t2 WHERE ( 3 , 1 ) NOT IN ( SELECT f1 , f2 FROM t1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * FROM t2 WHERE ( 3 , 1 ) NOT IN ( SELECT f1 , f2 FROM t1 ); f3 5 @@ -960,9 +960,9 @@ CREATE TABLE t2 (c int, d int); INSERT INTO t2 VALUES (2,3),(4,5),(6, NULL); set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off'; EXPLAIN SELECT * FROM t1 WHERE (a, b) NOT IN (SELECT c, d FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 SELECT * FROM t1 WHERE (a, b) NOT IN (SELECT c, d FROM t2); a b 0 NULL @@ -971,9 +971,9 @@ a b subq_res 0 NULL 1 2 NULL NULL EXPLAIN SELECT * FROM t1 WHERE (a, b) NOT IN (SELECT c, d FROM t2 WHERE d is not NULL); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * FROM t1 WHERE (a, b) NOT IN (SELECT c, d FROM t2 WHERE d is not NULL); a b 0 NULL diff --git a/mysql-test/main/subselect_sj.result b/mysql-test/main/subselect_sj.result index 9fd8186b66c..c231cfd0c0b 100644 --- a/mysql-test/main/subselect_sj.result +++ b/mysql-test/main/subselect_sj.result @@ -20,9 +20,9 @@ create table t12 like t10; insert into t12 select * from t10; Flattened because of dependency, t10=func(t1) explain select * from t1 where a in (select pk from t10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index select * from t1 where a in (select pk from t10); a b 0 0 @@ -30,27 +30,27 @@ a b 2 2 A confluent case of dependency explain select * from t1 where a in (select a from t10 where pk=12); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables select * from t1 where a in (select a from t10 where pk=12); a b explain select * from t1 where a in (select a from t10 where pk=9); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t10 const PRIMARY PRIMARY 4 const 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t10 NULL const PRIMARY PRIMARY 4 const 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where select * from t1 where a in (select a from t10 where pk=9); a b An empty table inside explain select * from t1 where a in (select a from t11); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables select * from t1 where a in (select a from t11); a b explain select * from t1 where a in (select pk from t10) and b in (select pk from t10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index -1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index +1 PRIMARY t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using index select * from t1 where a in (select pk from t10) and b in (select pk from t10); a b 0 0 @@ -58,10 +58,10 @@ a b 2 2 flattening a nested subquery explain select * from t1 where a in (select pk from t10 where t10.a in (select pk from t12)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where -1 PRIMARY t12 eq_ref PRIMARY PRIMARY 4 test.t10.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where +1 PRIMARY t12 NULL eq_ref PRIMARY PRIMARY 4 test.t10.a 1 Using index select * from t1 where a in (select pk from t10 where t10.a in (select pk from t12)); a b 0 0 @@ -69,29 +69,29 @@ a b 2 2 flattening subquery w/ several tables explain extended select * from t1 where a in (select t10.pk from t10, t12 where t12.pk=t10.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where -1 PRIMARY t12 eq_ref PRIMARY PRIMARY 4 test.t10.a 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where +1 PRIMARY t12 NULL eq_ref PRIMARY PRIMARY 4 test.t10.a 1 100.00 Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where `test`.`t12`.`pk` = `test`.`t10`.`a` and `test`.`t10`.`pk` = `test`.`t1`.`a` subqueries within outer joins go into ON expr. explAin extended select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY A ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY B ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index +id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY A NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY B NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t10 NULL index PRIMARY PRIMARY 4 NULL 10 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(`test`.`A`.`A` = `test`.`t1`.`A` And <in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (/* select#2 */ select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where `test`.`B`.`A` = `<suBquery2>`.`pk`)))) where 1 t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" explAin extended select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index +id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t10 NULL index PRIMARY PRIMARY 4 NULL 10 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`A` = `test`.`t1`.`A` And <in_optimizer>(`test`.`t1`.`A`,`test`.`t1`.`A` in ( <mAteriAlize> (/* select#2 */ select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t1`.`A` in <temporAry tABle> on distinct_key where `test`.`t1`.`A` = `<suBquery2>`.`pk`)))) where 1 set @save_join_buffer_size=@@join_buffer_size; @@ -109,77 +109,77 @@ select m00.a from t1 m00, t1 m01, t1 m02, t1 m03, t1 m04,t1 m05,t1 m06,t1 m07,t1 m08,t1 m09, t1 m10, t1 m11, t1 m12, t1 m13, t1 m14,t1 m15,t1 m16,t1 m17,t1 m18,t1 m19 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY s00 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY s01 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s02 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s03 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s04 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s05 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s06 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s07 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s08 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s09 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s10 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s11 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s12 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s13 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s14 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s15 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s16 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s17 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s18 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s19 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s20 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s21 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s22 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s23 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s24 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s25 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s26 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s27 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s28 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s29 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s30 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s31 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s32 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s33 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s34 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s35 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s36 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s37 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s38 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s39 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s40 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s41 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s42 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s43 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s44 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s45 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s46 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s47 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s48 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s49 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m00 ALL NULL NULL NULL NULL 3 Using where -2 DEPENDENT SUBQUERY m01 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m02 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m03 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m04 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m05 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m06 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m07 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m08 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m09 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m10 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m11 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m12 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m13 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m14 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m15 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m16 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m17 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m18 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m19 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY s00 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY s01 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s02 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s03 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s04 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s05 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s06 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s07 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s08 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s09 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s10 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s11 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s12 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s13 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s14 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s15 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s16 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s17 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s18 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s19 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s20 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s21 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s22 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s23 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s24 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s25 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s26 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s27 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s28 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s29 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s30 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s31 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s32 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s33 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s34 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s35 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s36 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s37 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s38 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s39 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s40 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s41 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s42 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s43 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s44 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s45 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s46 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s47 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s48 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s49 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m00 NULL ALL NULL NULL NULL NULL 3 Using where +2 DEPENDENT SUBQUERY m01 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m02 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m03 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m04 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m05 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m06 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m07 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m08 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m09 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m10 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m11 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m12 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m13 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m14 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m15 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m16 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m17 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m18 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m19 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) select * from t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t10)) where t1.a < 5; @@ -204,9 +204,9 @@ a b a b 2 2 2 2 insert into t1 select (A.a + 10 * B.a),1 from t0 A, t0 B; explain extended select * from t1 where a in (select pk from t10 where pk<3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t10 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index -1 PRIMARY t1 ALL NULL NULL NULL NULL 103 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t10 NULL range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 103 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t10`.`pk` and `test`.`t10`.`pk` < 3 drop table t0, t1, t2; @@ -342,10 +342,10 @@ WHERE EMPNUM IN (SELECT EMPNUM FROM WORKS WHERE PNUM IN (SELECT PNUM FROM PROJ)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY STAFF ALL NULL NULL NULL NULL 5 -1 PRIMARY PROJ ALL NULL NULL NULL NULL 6 -1 PRIMARY WORKS ALL NULL NULL NULL NULL 12 Using where; FirstMatch(STAFF) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY STAFF NULL ALL NULL NULL NULL NULL 5 +1 PRIMARY PROJ NULL ALL NULL NULL NULL NULL 6 +1 PRIMARY WORKS NULL ALL NULL NULL NULL NULL 12 Using where; FirstMatch(STAFF) SELECT EMPNUM, EMPNAME FROM STAFF WHERE EMPNUM IN @@ -499,10 +499,10 @@ INSERT INTO t0 VALUES (1,'g','g'), (2,'v','v'), (3,'t','t'), (4,'u','u'), (5,'n','n'); EXPLAIN EXTENDED SELECT vkey FROM t0 WHERE pk IN (SELECT t1.pk FROM t0 t1 JOIN t0 t2 ON t2.vkey = t1.vnokey); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t0 ALL PRIMARY NULL NULL NULL 5 100.00 -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t0.pk 1 100.00 Using where -1 PRIMARY t2 ref vkey vkey 4 test.t1.vnokey 2 100.00 Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL PRIMARY NULL NULL NULL 5 100.00 +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t0.pk 1 100.00 Using where +1 PRIMARY t2 NULL ref vkey vkey 4 test.t1.vnokey 2 100.00 Using index; FirstMatch(t1) Warnings: Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where `test`.`t1`.`pk` = `test`.`t0`.`pk` and `test`.`t2`.`vkey` = `test`.`t1`.`vnokey` SELECT vkey FROM t0 WHERE pk IN @@ -729,11 +729,11 @@ EXPLAIN SELECT int_key FROM ot1 WHERE int_nokey IN (SELECT it2.int_key FROM it1 LEFT JOIN it2 ON it2.datetime_key); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot1 ALL NULL NULL NULL NULL 20 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it1 index NULL int_key 4 NULL 2 Using index -2 MATERIALIZED it2 ALL int_key,datetime_key NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 20 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it1 NULL index NULL int_key 4 NULL 2 Using index +2 MATERIALIZED it2 NULL ALL int_key,datetime_key NULL NULL NULL 20 Using where DROP TABLE ot1, it1, it2; # End of BUG#38075 # @@ -762,10 +762,10 @@ insert into t3 values (20); explain extended select a from t1 where a in (select c from t2 where d >= some(select e from t3 where b=e)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 Using where; FirstMatch(t1) -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 7 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; FirstMatch(t1) +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`c` = `test`.`t1`.`a` and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(/* select#3 */ select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and <cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`)))) @@ -803,19 +803,19 @@ INSERT INTO t1 VALUES (1,'o','ffff','ffff','ffoo','ffff','ffff','ffff','ffff','f CREATE TABLE t2 LIKE t1; INSERT INTO t2 VALUES (1,'i','iiii','iiii','iiii','iiii','ffff','ffff','ffff','ffff','ffff',GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))')), (2,'f','ffff','ffff','ffff','ffff','ffff','ffff','ffff','ffff','ffff',GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))')); EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 11 func,func 1 100.00 -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 11 func,func 1 100.00 +2 MATERIALIZED t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0); pk 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, c) IN (SELECT b, c FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`c` = `test`.`t1`.`c` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, c) IN (SELECT b, c FROM t2 WHERE pk > 0); @@ -823,18 +823,18 @@ pk 1 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, d) IN (SELECT b, d FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`d` = `test`.`t1`.`d` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, d) IN (SELECT b, d FROM t2 WHERE pk > 0); pk 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, e) IN (SELECT b, e FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`e` = `test`.`t1`.`e` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, e) IN (SELECT b, e FROM t2 WHERE pk > 0); @@ -842,9 +842,9 @@ pk 1 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, f) IN (SELECT b, f FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`f` = `test`.`t1`.`f` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, f) IN (SELECT b, f FROM t2 WHERE pk > 0); @@ -852,9 +852,9 @@ pk 1 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, g) IN (SELECT b, g FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`g` = `test`.`t1`.`g` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, g) IN (SELECT b, g FROM t2 WHERE pk > 0); @@ -862,9 +862,9 @@ pk 1 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, h) IN (SELECT b, h FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`h` = `test`.`t1`.`h` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, h) IN (SELECT b, h FROM t2 WHERE pk > 0); @@ -872,9 +872,9 @@ pk 1 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`i` = `test`.`t1`.`i` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0); @@ -882,9 +882,9 @@ pk 1 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, j) IN (SELECT b, j FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`j` = `test`.`t1`.`j` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, j) IN (SELECT b, j FROM t2 WHERE pk > 0); @@ -892,9 +892,9 @@ pk 1 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, k) IN (SELECT b, k FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`k` = `test`.`t1`.`k` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, k) IN (SELECT b, k FROM t2 WHERE pk > 0); @@ -938,15 +938,15 @@ WHERE t1field IN (SELECT * FROM v2) AND t1field IN (SELECT * FROM v3) "; EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 Using index -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 Using index +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 Using index -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 Using index +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index DROP TABLE t1, t2, t3; DROP VIEW v2, v3; # End of Bug#49198 @@ -972,10 +972,10 @@ WHERE ( `varchar_nokey` , `varchar_nokey` ) IN ( SELECT `varchar_key` , `varchar_nokey` FROM t1 WHERE `varchar_nokey` < 'n' XOR `pk` ) ; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 18 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00 -2 MATERIALIZED t1 ALL varchar_key NULL NULL NULL 15 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 18 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED t1 NULL ALL varchar_key NULL NULL NULL 15 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`varchar_nokey` = `test`.`t1`.`varchar_key` and (`test`.`t1`.`varchar_key` < 'n' xor `test`.`t1`.`pk`) SELECT varchar_nokey @@ -1054,12 +1054,12 @@ WHERE t1.val IN (SELECT t2.val FROM t2 WHERE t2.val LIKE 'a%' OR t2.val LIKE 'e%') AND t1.val IN (SELECT t3.val FROM t3 WHERE t3.val LIKE 'a%' OR t3.val LIKE 'e%'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 13 func 1 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 13 func 1 -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 5 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 13 func 1 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 13 func 1 +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 5 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 Using where SELECT * FROM t1 WHERE t1.val IN (SELECT t2.val FROM t2 @@ -1248,9 +1248,9 @@ CREATE TABLE t2 (i INTEGER, j INTEGER, KEY k(i, j)); INSERT INTO t2 VALUES (1, 0), (1, 1), (2, 0), (2, 1); EXPLAIN SELECT * FROM t1 WHERE (i) IN (SELECT i FROM t2 where j > 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index k k 10 NULL 4 Using where; Using index; Start temporary -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index k k 10 NULL 4 Using where; Using index; Start temporary +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 Using where; End temporary; Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE (i) IN (SELECT i FROM t2 where j > 0); i 1 @@ -1305,10 +1305,10 @@ set optimizer_switch='materialization=off'; set optimizer_switch='semijoin=off'; explain select * from t1 where t1.a in (select t2.a from t2 left join t3 on t2.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where select * from t1 where t1.a in (select t2.a from t2 left join t3 on t2.a=t3.a); a 1 @@ -1316,10 +1316,10 @@ a set optimizer_switch='semijoin=on'; explain select * from t1 where t1.a in (select t2.a from t2 left join t3 on t2.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; Start temporary -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where; End temporary select * from t1 where t1.a in (select t2.a from t2 left join t3 on t2.a=t3.a); a 1 @@ -1341,11 +1341,11 @@ EXPLAIN SELECT * FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2inner ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2inner NULL ALL NULL NULL NULL NULL 2 +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a); @@ -1357,11 +1357,11 @@ EXPLAIN SELECT * FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 -2 MATERIALIZED t2inner ALL NULL NULL NULL NULL 2 -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED t2inner NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a); @@ -1373,11 +1373,11 @@ EXPLAIN SELECT * FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Start temporary -1 PRIMARY t2inner ALL NULL NULL NULL NULL 2 -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Start temporary +1 PRIMARY t2inner NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where; End temporary SELECT * FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a); @@ -1445,11 +1445,11 @@ FROM ot1 LEFT JOIN (ot2 JOIN ot3 on ot2.a=ot3.a) ON ot1.a=ot2.a AND ot1.a IN (SELECT a from it1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot1 ALL NULL NULL NULL NULL 8 -1 PRIMARY ot3 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY ot2 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY it1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 8 +1 PRIMARY ot3 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY ot2 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY it1 NULL ALL NULL NULL NULL NULL 8 Using where SELECT * FROM ot1 LEFT JOIN @@ -1496,11 +1496,11 @@ FROM ot1 LEFT JOIN (ot2 JOIN ot3 on ot2.a=ot3.a) ON ot1.a=ot2.a AND ot1.a IN (SELECT a from it1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot1 ALL NULL NULL NULL NULL 8 -1 PRIMARY ot3 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY ot2 ALL NULL NULL NULL NULL 4 Using where -2 MATERIALIZED it1 ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 8 +1 PRIMARY ot3 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY ot2 NULL ALL NULL NULL NULL NULL 4 Using where +2 MATERIALIZED it1 NULL ALL NULL NULL NULL NULL 8 SELECT * FROM ot1 LEFT JOIN @@ -1560,11 +1560,11 @@ EXPLAIN SELECT * FROM t3 WHERE f2 IN (SELECT t1.f1 FROM t1 LEFT OUTER JOIN (t2 AS b1 JOIN t2 AS b2 ON TRUE) ON TRUE); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 14 Using where -2 MATERIALIZED t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED b1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED b2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 14 Using where +2 MATERIALIZED t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED b1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED b2 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t3 WHERE f2 IN (SELECT t1.f1 FROM t1 LEFT OUTER JOIN (t2 AS b1 JOIN t2 AS b2 ON TRUE) ON TRUE); @@ -1578,12 +1578,12 @@ EXPLAIN SELECT * FROM t3 WHERE f2 IN (SELECT t1.f1 FROM t1 LEFT OUTER JOIN (t2 AS b1 JOIN t2 AS b2 ON TRUE) ON TRUE); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 1 -1 PRIMARY t3 ALL NULL NULL NULL NULL 14 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED b1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED b2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 1 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 14 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED b1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED b2 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t3 WHERE f2 IN (SELECT t1.f1 FROM t1 LEFT OUTER JOIN (t2 AS b1 JOIN t2 AS b2 ON TRUE) ON TRUE); @@ -1608,11 +1608,11 @@ WHERE A.t1field IN (SELECT A.t1field FROM t2 B) AND A.t1field IN (SELECT C.t2field FROM t2 C WHERE C.t2field IN (SELECT D.t2field FROM t2 D)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A index PRIMARY PRIMARY 4 NULL 3 Using index -1 PRIMARY B index NULL PRIMARY 4 NULL 3 Using index; Start temporary; End temporary -1 PRIMARY C eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 Using index -1 PRIMARY D eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL index PRIMARY PRIMARY 4 NULL 3 Using index +1 PRIMARY B NULL index NULL PRIMARY 4 NULL 3 Using index; Start temporary; End temporary +1 PRIMARY C NULL eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 Using index +1 PRIMARY D NULL eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 Using index SELECT * FROM t1 A WHERE A.t1field IN (SELECT A.t1field FROM t2 B) AND @@ -1637,13 +1637,13 @@ a a explain select * from t1 A, t1 B where A.a = B.a and A.a in (select a from t2 C) and B.a in (select a from t2 D); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 3 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY B ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED C ALL NULL NULL NULL NULL 3 -3 MATERIALIZED D ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY B NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED C NULL ALL NULL NULL NULL NULL 3 +3 MATERIALIZED D NULL ALL NULL NULL NULL NULL 3 drop table t1, t2; # # BUG#784441: Abort on semijoin with a view as the inner table @@ -1655,11 +1655,11 @@ INSERT INTO t2 VALUES (1), (1); CREATE VIEW v1 AS SELECT 1; EXPLAIN SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived3> system NULL NULL NULL NULL 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived3> NULL system NULL NULL NULL NULL 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1); a a 1 1 @@ -1760,11 +1760,11 @@ insert into t3 values('three'),( 'four'); insert into t3 values('three'),( 'four'); insert into t3 values('three'),( 'four'); explain select * from t3 where t3.b in (select t2.b from t1 left join t2 on t1.a=t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 8 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 10 func 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 8 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 10 func 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using where select * from t3 where t3.b in (select t2.b from t1 left join t2 on t1.a=t2.a); b drop table t1, t2, t3; @@ -1815,10 +1815,10 @@ set optimizer_switch='firstmatch=off,loosescan=off,materialization=off'; # Check DuplicateWeedout + join buffer explain select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where; End temporary select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a); a 1 @@ -1828,10 +1828,10 @@ set @tmp_jcl_20110622= @@join_cache_level; set join_cache_level= 0; explain select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where; End temporary select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a); a 1 @@ -1840,10 +1840,10 @@ a set optimizer_switch='firstmatch=on'; explain select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where; End temporary select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a); a 1 @@ -1859,11 +1859,11 @@ set join_cache_level= 0; explain select * from t0 where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary -1 PRIMARY t3 ALL NULL NULL NULL NULL 1 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where; End temporary select * from t0 where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a); a @@ -1874,11 +1874,11 @@ set @@join_cache_level=@tmp_jcl_20110622; explain select * from t0 where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary -1 PRIMARY t3 ALL NULL NULL NULL NULL 1 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where; End temporary select * from t0 where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a); a @@ -1892,11 +1892,11 @@ insert into t3 values(2,2); explain select * from t0 where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where; End temporary select * from t0 where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a); a @@ -1994,12 +1994,12 @@ CREATE VIEW v4 AS SELECT DISTINCT f2 FROM t4 ; # The following must not have outer joins: explain extended SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE t2.f3 IN (SELECT * FROM t4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t4 index f2 f2 5 NULL 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t4 NULL index f2 f2 5 NULL 2 100.00 Using index Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where `test`.`t3`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`f2` = `test`.`t2`.`f2` SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE t2.f3 IN (SELECT * FROM t4); @@ -2088,11 +2088,11 @@ INSERT INTO t4 VALUES (0),(NULL); # in the middle of the inner side of an outer join: explain SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE IFNULL(t2.f3,'foo') IN (SELECT * FROM t4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY t3 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3 ) WHERE IFNULL(t2.f3,'foo') IN (SELECT * FROM t4); f1 f2 f3 f3 2 0 0 0 @@ -2152,10 +2152,10 @@ INSERT INTO t3 VALUES (6,5),(6,2),(8,0),(9,1),(6,5); # This used to incorrectly pick a join order of (t1, LooseScan(t3), t2): explain SELECT * FROM t1, t2 WHERE (t2.a , t1.b) IN (SELECT a, b FROM t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 2 Using index; Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL b NULL NULL NULL 5 Using where; Start temporary; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 2 Using index; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL b NULL NULL NULL 5 Using where; Start temporary; End temporary SELECT * FROM t1, t2 WHERE (t2.a , t1.b) IN (SELECT a, b FROM t3); b a 5 6 @@ -2177,11 +2177,11 @@ CREATE TABLE t5 ( b int, a int , KEY (a,b)) ; INSERT INTO t5 VALUES (7,0),(9,0); explain SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t5 index a a 10 NULL 2 Using index; Start temporary -1 PRIMARY t4 ALL NULL NULL NULL NULL 3 -1 PRIMARY t2 ALL b NULL NULL NULL 10 Using where -1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t5 NULL index a a 10 NULL 2 Using index; Start temporary +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY t2 NULL ALL b NULL NULL NULL 10 Using where +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 15 Using where; End temporary; Using join buffer (flat, BNL join) SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b); a 0 @@ -2259,13 +2259,13 @@ WHERE alias1.c IN (SELECT SQ3_alias1.b FROM t2 AS SQ3_alias1 STRAIGHT_JOIN t2 AS SQ3_alias2) LIMIT 100; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY SQ3_alias1 ALL NULL NULL NULL NULL 20 Start temporary -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -1 PRIMARY SQ3_alias2 index NULL PRIMARY 4 NULL 20 Using index; End temporary -1 PRIMARY alias2 ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) -1 PRIMARY t2 ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) -2 DERIVED t2 ALL NULL NULL NULL NULL 20 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY SQ3_alias1 NULL ALL NULL NULL NULL NULL 20 Start temporary +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY SQ3_alias2 NULL index NULL PRIMARY 4 NULL 20 Using index; End temporary +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 20 create table t3 as SELECT alias1.a, alias1.b, alias1.c, alias1.d, alias1.e, alias1.f, @@ -2347,11 +2347,11 @@ CREATE TABLE t3 ( a int, d int) ; INSERT INTO t3 VALUES (19,1),(7,1),(3,1),(3,1),(20,1),(3,1),(16,1),(17,1),(9,1),(4,1),(6,1),(15,1),(17,1); explain SELECT * FROM t1 WHERE (a) IN (SELECT a FROM t2 JOIN t3 ON b = a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 9 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 13 Using where -2 MATERIALIZED t2 ref b b 4 test.t3.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 13 Using where +2 MATERIALIZED t2 NULL ref b b 4 test.t3.a 1 Using index SELECT * FROM t1 WHERE (a) IN (SELECT a FROM t2 JOIN t3 ON b = a); a 19 @@ -2402,9 +2402,9 @@ set optimizer_switch='firstmatch=off'; set optimizer_switch='semijoin_with_cache=on'; explain select * from t1 where t1.a in (select t2.a from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) select * from t1 where t1.a in (select t2.a from t2); a 1 @@ -2412,9 +2412,9 @@ a set optimizer_switch='semijoin_with_cache=off'; explain select * from t1 where t1.a in (select t2.a from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary select * from t1 where t1.a in (select t2.a from t2); a 1 @@ -2435,20 +2435,20 @@ SET SESSION optimizer_switch='semijoin=on,firstmatch=on'; SET SESSION optimizer_switch='loosescan=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index idx idx 9 NULL 2 Using where; Using index; Start temporary -1 PRIMARY t3 ref idx idx 4 test.t2.b 1 Using index -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index idx idx 9 NULL 2 Using where; Using index; Start temporary +1 PRIMARY t3 NULL ref idx idx 4 test.t2.b 1 Using index +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; End temporary; Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b); a 5 SET SESSION optimizer_switch='loosescan=on'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index idx idx 9 NULL 2 Using where; Using index; Start temporary -1 PRIMARY t3 ref idx idx 4 test.t2.b 1 Using index -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index idx idx 9 NULL 2 Using where; Using index; Start temporary +1 PRIMARY t3 NULL ref idx idx 4 test.t2.b 1 Using index +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; End temporary; Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b); a 5 @@ -2467,11 +2467,11 @@ set @tmp_otimizer_switch= @@optimizer_switch; SET SESSION optimizer_switch='semijoin=on,materialization=on'; EXPLAIN SELECT * FROM t1 RIGHT JOIN t2 ON b = a WHERE t2.b IN (SELECT c FROM t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 RIGHT JOIN t2 ON b = a WHERE t2.b IN (SELECT c FROM t3); a b 4 4 @@ -2497,12 +2497,12 @@ SET optimizer_prune_level=0; EXPLAIN SELECT * FROM t1, t2 WHERE t1.a = t2.a AND t2.a IN (SELECT b FROM t3 STRAIGHT_JOIN t4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 system NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 1 -1 PRIMARY t2 ref a a 5 const 1 Using index -1 PRIMARY t1 ref a a 5 func 1 Using index -2 MATERIALIZED t4 ALL NULL NULL NULL NULL 0 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 1 +1 PRIMARY t2 NULL ref a a 5 const 1 Using index +1 PRIMARY t1 NULL ref a a 5 func 1 Using index +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 0 SELECT * FROM t1, t2 WHERE t1.a = t2.a AND t2.a IN (SELECT b FROM t3 STRAIGHT_JOIN t4); a a @@ -2573,11 +2573,11 @@ explain SELECT a, b, d FROM t1, t2 WHERE ( b, d ) IN ( SELECT b, d FROM t1, t2 WHERE b = c ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 -1 PRIMARY t1 index b b 5 NULL 10 Using where; Using index; LooseScan -1 PRIMARY t2 ref c c 5 test.t1.b 1 Using where; FirstMatch(t1) -1 PRIMARY t1 ref b b 5 test.t1.b 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 +1 PRIMARY t1 NULL index b b 5 NULL 10 Using where; Using index; LooseScan +1 PRIMARY t2 NULL ref c c 5 test.t1.b 1 Using where; FirstMatch(t1) +1 PRIMARY t1 NULL ref b b 5 test.t1.b 2 SELECT a, b, d FROM t1, t2 WHERE ( b, d ) IN ( SELECT b, d FROM t1, t2 WHERE b = c ); @@ -2636,11 +2636,11 @@ delete from t1 where kp2 in (1,3); explain select sum(t2.a) from t2,t3 where (t3.a,t2.a) in (select kp1,kp2 from t1,t0 where t0.a=2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 const PRIMARY PRIMARY 4 const 1 Using index -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY t1 ref kp1 kp1 5 test.t3.a 10 Using where; Using index; LooseScan -1 PRIMARY t2 ref a a 5 test.t1.kp2 19 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 10 Using where; Using index; LooseScan +1 PRIMARY t2 NULL ref a a 5 test.t1.kp2 19 Using index select sum(t2.a) from t2,t3 where (t3.a,t2.a) in (select kp1,kp2 from t1,t0 where t0.a=2); @@ -2710,9 +2710,9 @@ a 18 19 explain select * from t3 where a in (select kp1 from t1 where kp1<20); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where -1 PRIMARY t1 ref kp1 kp1 5 test.t3.a 1 Using index; FirstMatch(t3) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 100 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 1 Using index; FirstMatch(t3) drop table t0,t1,t3; set optimizer_switch= @tmp_923246; # @@ -2766,11 +2766,11 @@ VIEW v1 AS SELECT * FROM t1; EXPLAIN SELECT * FROM t1 AS t1_1, t1 AS t1_2 WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_1 ALL NULL NULL NULL NULL 11 Using where -1 PRIMARY t1_2 ALL NULL NULL NULL NULL 11 -1 PRIMARY <derived3> ref key0 key0 5 test.t1_1.a 2 Using where; FirstMatch(t1_2) -3 DERIVED t1 ALL NULL NULL NULL NULL 11 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_1 NULL ALL NULL NULL NULL NULL 11 Using where +1 PRIMARY t1_2 NULL ALL NULL NULL NULL NULL 11 +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t1_1.a 2 Using where; FirstMatch(t1_2) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 SELECT * FROM t1 AS t1_1, t1 AS t1_2 WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 ); a b a b @@ -2926,10 +2926,10 @@ ON alias2.col_int_key = alias1.pk OR alias2.col_int_key = alias1.col_int_key WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o' ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 index_merge PRIMARY,col_int_key,col_varchar_key PRIMARY,col_varchar_key 4,4 NULL 2 Using sort_union(PRIMARY,col_varchar_key); Using where; Start temporary -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -1 PRIMARY alias2 ALL col_int_key NULL NULL NULL 12 Range checked for each record (index map: 0x2); End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL index_merge PRIMARY,col_int_key,col_varchar_key PRIMARY,col_varchar_key 4,4 NULL 2 Using sort_union(PRIMARY,col_varchar_key); Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 PRIMARY alias2 NULL ALL col_int_key NULL NULL NULL 12 Range checked for each record (index map: 0x2); End temporary SELECT * FROM t2 WHERE (field1) IN (SELECT alias1.col_varchar_nokey AS field1 @@ -3033,11 +3033,11 @@ pk c1 c2 # This should show that "t1 left join t3" is still in the semi-join nest: EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE pk IN ( SELECT pk FROM t1 LEFT JOIN t3 ON (c1 = c3 ) ) ORDER BY c2, c1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 Using temporary; Using filesort -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 5 100.00 Start temporary -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 100.00 -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 Using temporary; Using filesort +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 5 100.00 Start temporary +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 100.00 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; End temporary Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1` AS `c1`,'x' AS `c2` from `test`.`t1` semi join (`test`.`t1` left join `test`.`t3` on(`test`.`t1`.`c1` = `test`.`t3`.`c3`)) where `test`.`t1`.`pk` = `test`.`t1`.`pk` order by 'x',`test`.`t1`.`c1` DROP TABLE t1,t2,t3; @@ -3088,11 +3088,11 @@ CREATE TABLE t4 (f4 INT); INSERT INTO t4 VALUES (0),(5); explain SELECT * FROM t1, t2, t3 WHERE f2 IN ( f1 IN ( SELECT f4 FROM t4 ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ref f2 f2 5 const 0 Using where; Using index -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ref f2 f2 5 const 0 Using where; Using index +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t4 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1, t2, t3 WHERE f2 IN ( f1 IN ( SELECT f4 FROM t4 ) ); f1 f2 f3 1 0 1 @@ -3169,16 +3169,16 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain select a from t1, t2 where b between 1 and 2 and a in (select b from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 1462 Using index; FirstMatch(t1) -1 PRIMARY t2 range idx idx 5 NULL 5 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 1462 Using index; FirstMatch(t1) +1 PRIMARY t2 NULL range idx idx 5 NULL 5 Using where; Using index; Using join buffer (flat, BNL join) explain select a from t1 join t2 on b between 1 and 2 and a in (select b from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 1462 Using index; FirstMatch(t1) -1 PRIMARY t2 range idx idx 5 NULL 5 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 1462 Using index; FirstMatch(t1) +1 PRIMARY t2 NULL range idx idx 5 NULL 5 Using where; Using index; Using join buffer (flat, BNL join) drop table t1,t2; set optimizer_switch= @tmp_mdev12675; # @@ -3206,11 +3206,11 @@ FROM t1 LEFT JOIN ( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) ) ON (c1 = c3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where -2 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t3`.`c3` = `test`.`t1`.`c1` and <cache>(<in_optimizer>(1,<exists>(/* select#2 */ select `test`.`t4`.`c4` from `test`.`t4` where 1 = `test`.`t4`.`c4`)))) where 1 # mdev-12820 @@ -3227,11 +3227,11 @@ FROM t1 LEFT JOIN ( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 ) ON (c1 = c2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(`test`.`t2`.`c2` = `test`.`t1`.`c1` and <in_optimizer>(`test`.`t1`.`c1`,<exists>(/* select#3 */ select `test`.`t3`.`c3` from `test`.`t3` where <cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))) where 1 DROP TABLE t1,t2,t3,t4; @@ -3287,10 +3287,10 @@ Id 1 explain extended SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t2 ref col1 col1 5 const 2 100.00 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t2 NULL ref col1 col1 5 const 2 100.00 Using index condition; Using where Warnings: Note 1003 select 1 AS `Id` from (`test`.`t2`) where `test`.`t2`.`t1_Id` = 1 and `test`.`t2`.`col1` is null DROP TABLE t1, t2; @@ -3313,10 +3313,10 @@ insert into t4 select floor(rand()*1000) from t2 limit 500; # # Instead, it should use eq_ref on the materialized table. explain select * from t3 where a in (select a from t4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 10000 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t4 ALL NULL NULL NULL NULL 500 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 10000 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 500 drop table t1, t2, t3, t4; # # MDEV-20770: Server crashes in JOIN::transform_in_predicates_into_in_subq diff --git a/mysql-test/main/subselect_sj2.result b/mysql-test/main/subselect_sj2.result index 2d0df9a05d0..77f10643e32 100644 --- a/mysql-test/main/subselect_sj2.result +++ b/mysql-test/main/subselect_sj2.result @@ -53,10 +53,10 @@ a b 18 13 19 14 explain select * from t2 where b in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL b NULL NULL NULL 20 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL b NULL NULL NULL 20 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 select * from t2 where b in (select a from t1); a b 1 1 @@ -81,10 +81,10 @@ test.t2 analyze status OK test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK explain select * from t3 where b in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL b NULL NULL NULL 20 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL b NULL NULL NULL 20 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 select * from t3 where b in (select a from t1); a b pk1 pk2 pk3 1 1 1 1 1 @@ -107,10 +107,10 @@ insert into t3 select A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a from t0 A, t0 B where B.a <5; explain select * from t3 where b in (select a from t0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL b NULL NULL NULL # -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func # -2 MATERIALIZED t0 ALL NULL NULL NULL NULL # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL b NULL NULL NULL # +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func # +2 MATERIALIZED t0 NULL ALL NULL NULL NULL NULL # select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5); a b pk1 pk2 0 0 0 0 @@ -130,10 +130,10 @@ a b pk1 pk2 set join_buffer_size= @save_join_buffer_size; set max_heap_table_size= @save_max_heap_table_size; explain select * from t1 where a in (select b from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 index b b 5 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL index b b 5 NULL 20 Using index select * from t1; a b 1 1 @@ -159,10 +159,10 @@ insert into t2 values (19, 'duplicate ok', 'duplicate ok'); explain select a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z from t1 ot where a in (select a from t2 it); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot ALL NULL NULL NULL NULL 32 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it ALL NULL NULL NULL NULL 22 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 32 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 22 select a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z from t1 ot where a in (select a from t2 it); @@ -192,10 +192,10 @@ a mid(filler1, 1,10) Z explain select a, mid(filler1, 1,10), length(filler1)=length(filler2) from t2 ot where a in (select a from t1 it); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot ALL NULL NULL NULL NULL 22 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it ALL NULL NULL NULL NULL 32 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 22 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 32 select a, mid(filler1, 1,10), length(filler1)=length(filler2) from t2 ot where a in (select a from t1 it); @@ -227,10 +227,10 @@ insert into t1 select a+20, 'filler123456', 'filler123456' from t0; explain select a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z from t1 ot where a in (select a from t2 it); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot ALL NULL NULL NULL NULL 52 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it ALL NULL NULL NULL NULL 22 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 52 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 22 select a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z from t1 ot where a in (select a from t2 it); @@ -260,10 +260,10 @@ a mid(filler1, 1,10) Z explain select a, mid(filler1, 1,10), length(filler1)=length(filler2) from t2 ot where a in (select a from t1 it); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot ALL NULL NULL NULL NULL 22 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it ALL NULL NULL NULL NULL 52 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 22 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 52 select a, mid(filler1, 1,10), length(filler1)=length(filler2) from t2 ot where a in (select a from t1 it); @@ -301,12 +301,12 @@ t2 and t3 must be use 'ref', not 'ALL': explain select * from t0 where a in (select t2.a+t3.a from t1 left join (t2 join t3) on t2.a=t1.a and t3.a=t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 10 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func 1 Using where -2 MATERIALIZED t1 range a a 5 NULL 10 Using where; Using index -2 MATERIALIZED t2 ref a a 5 test.t1.a 1 Using index -2 MATERIALIZED t3 ref a a 5 test.t1.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 10 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func 1 Using where +2 MATERIALIZED t1 NULL range a a 5 NULL 10 Using where; Using index +2 MATERIALIZED t2 NULL ref a a 5 test.t1.a 1 Using index +2 MATERIALIZED t3 NULL ref a a 5 test.t1.a 1 Using index drop table t0, t1,t2,t3; CREATE TABLE t1 ( ID int(11) NOT NULL auto_increment, @@ -343,10 +343,10 @@ AND t2.Code IN (SELECT Country FROM t3 WHERE Language='English' AND Percentage > 10 AND t2.Population > 100000); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range Population,Country Population 4 NULL 1 Using index condition; Rowid-ordered scan; Start temporary -1 PRIMARY t2 eq_ref PRIMARY,Population PRIMARY 3 test.t1.Country 1 Using where; End temporary -1 PRIMARY t3 eq_ref PRIMARY,Percentage PRIMARY 33 test.t1.Country,const 1 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range Population,Country Population 4 NULL 1 Using index condition; Rowid-ordered scan; Start temporary +1 PRIMARY t2 NULL eq_ref PRIMARY,Population PRIMARY 3 test.t1.Country 1 Using where; End temporary +1 PRIMARY t3 NULL eq_ref PRIMARY,Percentage PRIMARY 33 test.t1.Country,const 1 Using index condition; Using where set optimizer_switch=@bug35674_save_optimizer_switch; DROP TABLE t1,t2,t3; CREATE TABLE t1 ( @@ -381,10 +381,10 @@ This must not use LooseScan: EXPLAIN SELECT Name FROM t1 WHERE t1.Code IN ( SELECT t2.CountryCode FROM t2 WHERE Population > 5000000); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 31 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 3 func 1 -2 MATERIALIZED t2 ALL CountryCode NULL NULL NULL 545 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 31 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 +2 MATERIALIZED t2 NULL ALL CountryCode NULL NULL NULL 545 Using where SELECT Name FROM t1 WHERE t1.Code IN ( SELECT t2.CountryCode FROM t2 WHERE Population > 5000000); @@ -464,10 +464,10 @@ Table t2, unlike table t1, should be displayed as pulled out explain extended select * from t0 where t0.a in ( select t1.a from t1,t2 where t2.a=t0.a and t1.b=t2.b); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 5 100.00 Using where -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 -1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 +1 PRIMARY t1 NULL ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2) Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` @@ -616,10 +616,10 @@ create table t3 (pk int, a int, primary key(pk)); insert into t3 select a,a from t0; explain select * from t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t3)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 Using where -2 MATERIALIZED t3 index PRIMARY PRIMARY 4 NULL 10 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 Using where +2 MATERIALIZED t3 NULL index PRIMARY PRIMARY 4 NULL 10 Using index drop table t0, t1, t2, t3; create table t1 (a int); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -730,10 +730,10 @@ insert into t3 select @a:=@a+1, t2.a from t2, t0; alter table t3 add primary key(id), add key(a); The following must use loose index scan over t3, key a: explain select count(a) from t2 where a in ( SELECT a FROM t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index a a 5 NULL 1000 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t3 index a a 5 NULL 30000 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index a a 5 NULL 1000 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t3 NULL index a a 5 NULL 30000 Using index select count(a) from t2 where a in ( SELECT a FROM t3); count(a) 1000 @@ -744,8 +744,8 @@ BUG#42740: crash in optimize_semijoin_nests create table t1 (c6 timestamp,key (c6)) engine=innodb; create table t2 (c2 double) engine=innodb; explain select 1 from t2 where c2 = any (select log10(null) from t1 where c6 <null) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables drop table t1, t2; # # BUG#42742: crash in setup_sj_materialization, Copy_field::set @@ -757,12 +757,12 @@ create table t2 (c1 tinytext,c2 text,c6 timestamp) engine=innodb; explain select 1 from t2 where c2 in (select 1 from t3, t2) and c1 in (select convert(c6,char(1)) from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 FirstMatch((sj-nest)) -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 FirstMatch((sj-nest)) +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 drop table t2, t3; # # BUG#761598: InnoDB: Error: row_search_for_mysql() is called without ha_innobase::external_lock() in maria-5.3 @@ -825,11 +825,11 @@ test.t3 analyze status OK explain SELECT * FROM t3 WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 const PRIMARY PRIMARY 4 const # Using index -1 PRIMARY alias2 index f12 f12 7 NULL # Using index; LooseScan -1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2) -1 PRIMARY t3 ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL const PRIMARY PRIMARY 4 const # Using index +1 PRIMARY alias2 NULL index f12 f12 7 NULL # Using index; LooseScan +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join) SELECT * FROM t3 WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24); f12 @@ -896,13 +896,13 @@ CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; EXPLAIN SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a WHERE t3.b IN (SELECT b FROM t4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 -2 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 -3 DERIVED t1 ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 2 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 1 SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a WHERE t3.b IN (SELECT b FROM t4); a b b a @@ -956,11 +956,11 @@ SELECT * FROM t1 WHERE b IN ( SELECT d FROM t2, t1 WHERE a = d AND ( pk < 2 OR d = 'z' ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t1 ref b b 4 test.t2.d 1 -2 MATERIALIZED t2 index_merge PRIMARY,d d,PRIMARY 4,4 NULL 2 Using sort_union(d,PRIMARY); Using where -2 MATERIALIZED t1 ref a a 5 test.t2.d 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 +1 PRIMARY t1 NULL ref b b 4 test.t2.d 1 +2 MATERIALIZED t2 NULL index_merge PRIMARY,d d,PRIMARY 4,4 NULL 2 Using sort_union(d,PRIMARY); Using where +2 MATERIALIZED t1 NULL ref a a 5 test.t2.d 1 Using where; Using index SELECT * FROM t1 WHERE b IN ( SELECT d FROM t2, t1 WHERE a = d AND ( pk < 2 OR d = 'z' ) @@ -1029,11 +1029,11 @@ WHERE (a, a) IN (SELECT alias2.b, alias2.a FROM t1 AS alias1, t1 AS alias2 WHERE alias2.b = alias1.a AND (alias1.b >= alias1.a OR alias2.b = 'z')); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL a NULL NULL NULL 38 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -2 MATERIALIZED alias1 ALL a NULL NULL NULL 19 Using where -2 MATERIALIZED alias2 ref a a 4 test.alias1.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL a NULL NULL NULL 38 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED alias1 NULL ALL a NULL NULL NULL 19 Using where +2 MATERIALIZED alias2 NULL ref a a 4 test.alias1.a 1 Using where SELECT * FROM t2 WHERE (a, a) IN (SELECT alias2.b, alias2.a FROM t1 AS alias1, t1 AS alias2 WHERE @@ -1125,12 +1125,12 @@ SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 WHERE alias5.b = alias4.b AND ( alias5.b >= alias3.b OR alias5.c != alias3.c ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL # Using where -1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d # Using index -1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) -1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) -1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias3 NULL ALL PRIMARY NULL NULL NULL # Using where +1 PRIMARY alias4 NULL ref PRIMARY,c c 4 test.alias3.d # Using index +1 PRIMARY alias5 NULL eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 WHERE alias3.d IN ( SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 @@ -1146,12 +1146,12 @@ SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 WHERE alias5.b = alias4.b AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL # Using where -1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d # Using index -1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) -1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) -1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias3 NULL ALL PRIMARY NULL NULL NULL # Using where +1 PRIMARY alias4 NULL ref PRIMARY,c c 4 test.alias3.d # Using index +1 PRIMARY alias5 NULL eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 WHERE alias3.d IN ( SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 @@ -1188,9 +1188,9 @@ CREATE TABLE t3 (c INT, INDEX(c)) engine=innodb; INSERT INTO t2 VALUES (4),(5); explain SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL No matching min/max row SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) ); a DROP TABLE t1,t2,t3; @@ -1210,11 +1210,11 @@ SELECT * FROM t1, t3 WHERE t3_c IN ( SELECT t1_pk2 FROM t4, t2 WHERE t2_c = t1_p t1_pk1 t1_pk2 t3_i t3_c explain SELECT * FROM t1, t3 WHERE t3_c IN ( SELECT t1_pk2 FROM t4, t2 WHERE t2_c = t1_pk2 AND t2_i >= t3_i ) AND ( t1_pk1 = 'POL' ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref PRIMARY PRIMARY 5 const 1 Using where; Using index -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Start temporary -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t4 index NULL PRIMARY 59 NULL 2 Using where; Using index; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref PRIMARY PRIMARY 5 const 1 Using where; Using index +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t4 NULL index NULL PRIMARY 59 NULL 2 Using where; Using index; End temporary DROP TABLE t1,t2,t3,t4; # # MDEV-6263: Wrong result when using IN subquery with order by @@ -1331,11 +1331,11 @@ ON T2_1_.t1idref=T1_1_.t1id WHERE T3_0_.t3idref= 1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY T3_0_ ref PRIMARY,FK_T3_T2Id PRIMARY 8 const 3 Using index; Start temporary -1 PRIMARY T2_1_ eq_ref PRIMARY,FK_T2_T1Id PRIMARY 8 test.T3_0_.t2idref 1 -1 PRIMARY T1_1_ eq_ref PRIMARY PRIMARY 8 test.T2_1_.t1idref 1 Using index -1 PRIMARY T2_0_ ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY T3_0_ NULL ref PRIMARY,FK_T3_T2Id PRIMARY 8 const 3 Using index; Start temporary +1 PRIMARY T2_1_ NULL eq_ref PRIMARY,FK_T2_T1Id PRIMARY 8 test.T3_0_.t2idref 1 +1 PRIMARY T1_1_ NULL eq_ref PRIMARY PRIMARY 8 test.T2_1_.t1idref 1 Using index +1 PRIMARY T2_0_ NULL ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary drop table t3,t2,t1; set optimizer_search_depth=@tmp7474; # diff --git a/mysql-test/main/subselect_sj2.test b/mysql-test/main/subselect_sj2.test index be2d91571e7..27a0ec7ea13 100644 --- a/mysql-test/main/subselect_sj2.test +++ b/mysql-test/main/subselect_sj2.test @@ -87,7 +87,7 @@ insert into t3 select A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a from t0 A, t0 B where B.a <5; ---replace_column 9 # +--replace_column 10 # explain select * from t3 where b in (select a from t0); select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5); @@ -997,7 +997,7 @@ INSERT INTO t3 VALUES ('r'),('s'),('t'),('v'),('w'),('x'),('y'); analyze table t1,t2,t3 persistent for all; --echo # The following must use LooseScan but not join buffering ---replace_column 9 # +--replace_column 10 # explain SELECT * FROM t3 WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24); @@ -1228,7 +1228,7 @@ INSERT INTO t2 VALUES analyze table t1 persistent for all; analyze table t2 persistent for all; ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 WHERE alias3.d IN ( @@ -1248,7 +1248,7 @@ WHERE alias3.d IN ( # Do the same EXPLAIN SELECT and SELECT # with "alias3.c != alias5.c" instead of "alias5.c != alias3.c" ---replace_column 9 # +--replace_column 10 # EXPLAIN SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 WHERE alias3.d IN ( diff --git a/mysql-test/main/subselect_sj2_jcl6.result b/mysql-test/main/subselect_sj2_jcl6.result index f0e8e9b4881..70ad99623cd 100644 --- a/mysql-test/main/subselect_sj2_jcl6.result +++ b/mysql-test/main/subselect_sj2_jcl6.result @@ -64,10 +64,10 @@ a b 18 13 19 14 explain select * from t2 where b in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL b NULL NULL NULL 20 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL b NULL NULL NULL 20 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 select * from t2 where b in (select a from t1); a b 1 1 @@ -92,10 +92,10 @@ test.t2 analyze status OK test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK explain select * from t3 where b in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL b NULL NULL NULL 20 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL b NULL NULL NULL 20 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 select * from t3 where b in (select a from t1); a b pk1 pk2 pk3 1 1 1 1 1 @@ -118,10 +118,10 @@ insert into t3 select A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a from t0 A, t0 B where B.a <5; explain select * from t3 where b in (select a from t0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL b NULL NULL NULL # -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func # -2 MATERIALIZED t0 ALL NULL NULL NULL NULL # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL b NULL NULL NULL # +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func # +2 MATERIALIZED t0 NULL ALL NULL NULL NULL NULL # select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5); a b pk1 pk2 0 0 0 0 @@ -141,10 +141,10 @@ a b pk1 pk2 set join_buffer_size= @save_join_buffer_size; set max_heap_table_size= @save_max_heap_table_size; explain select * from t1 where a in (select b from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 index b b 5 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL index b b 5 NULL 20 Using index select * from t1; a b 1 1 @@ -170,10 +170,10 @@ insert into t2 values (19, 'duplicate ok', 'duplicate ok'); explain select a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z from t1 ot where a in (select a from t2 it); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot ALL NULL NULL NULL NULL 32 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it ALL NULL NULL NULL NULL 22 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 32 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 22 select a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z from t1 ot where a in (select a from t2 it); @@ -203,10 +203,10 @@ a mid(filler1, 1,10) Z explain select a, mid(filler1, 1,10), length(filler1)=length(filler2) from t2 ot where a in (select a from t1 it); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot ALL NULL NULL NULL NULL 22 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it ALL NULL NULL NULL NULL 32 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 22 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 32 select a, mid(filler1, 1,10), length(filler1)=length(filler2) from t2 ot where a in (select a from t1 it); @@ -238,10 +238,10 @@ insert into t1 select a+20, 'filler123456', 'filler123456' from t0; explain select a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z from t1 ot where a in (select a from t2 it); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot ALL NULL NULL NULL NULL 52 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it ALL NULL NULL NULL NULL 22 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 52 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 22 select a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z from t1 ot where a in (select a from t2 it); @@ -271,10 +271,10 @@ a mid(filler1, 1,10) Z explain select a, mid(filler1, 1,10), length(filler1)=length(filler2) from t2 ot where a in (select a from t1 it); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot ALL NULL NULL NULL NULL 22 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it ALL NULL NULL NULL NULL 52 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 22 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 52 select a, mid(filler1, 1,10), length(filler1)=length(filler2) from t2 ot where a in (select a from t1 it); @@ -312,12 +312,12 @@ t2 and t3 must be use 'ref', not 'ALL': explain select * from t0 where a in (select t2.a+t3.a from t1 left join (t2 join t3) on t2.a=t1.a and t3.a=t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 10 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func 1 Using where -2 MATERIALIZED t1 range a a 5 NULL 10 Using where; Using index -2 MATERIALIZED t2 ref a a 5 test.t1.a 1 Using index -2 MATERIALIZED t3 ref a a 5 test.t1.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 10 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func 1 Using where +2 MATERIALIZED t1 NULL range a a 5 NULL 10 Using where; Using index +2 MATERIALIZED t2 NULL ref a a 5 test.t1.a 1 Using index +2 MATERIALIZED t3 NULL ref a a 5 test.t1.a 1 Using index drop table t0, t1,t2,t3; CREATE TABLE t1 ( ID int(11) NOT NULL auto_increment, @@ -354,10 +354,10 @@ AND t2.Code IN (SELECT Country FROM t3 WHERE Language='English' AND Percentage > 10 AND t2.Population > 100000); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range Population,Country Population 4 NULL 1 Using index condition; Rowid-ordered scan; Start temporary -1 PRIMARY t2 eq_ref PRIMARY,Population PRIMARY 3 test.t1.Country 1 Using where; End temporary; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 PRIMARY t3 eq_ref PRIMARY,Percentage PRIMARY 33 test.t1.Country,const 1 Using index condition; Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range Population,Country Population 4 NULL 1 Using index condition; Rowid-ordered scan; Start temporary +1 PRIMARY t2 NULL eq_ref PRIMARY,Population PRIMARY 3 test.t1.Country 1 Using where; End temporary; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY t3 NULL eq_ref PRIMARY,Percentage PRIMARY 33 test.t1.Country,const 1 Using index condition; Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan set optimizer_switch=@bug35674_save_optimizer_switch; DROP TABLE t1,t2,t3; CREATE TABLE t1 ( @@ -392,10 +392,10 @@ This must not use LooseScan: EXPLAIN SELECT Name FROM t1 WHERE t1.Code IN ( SELECT t2.CountryCode FROM t2 WHERE Population > 5000000); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 31 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 3 func 1 -2 MATERIALIZED t2 ALL CountryCode NULL NULL NULL 545 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 31 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 +2 MATERIALIZED t2 NULL ALL CountryCode NULL NULL NULL 545 Using where SELECT Name FROM t1 WHERE t1.Code IN ( SELECT t2.CountryCode FROM t2 WHERE Population > 5000000); @@ -475,10 +475,10 @@ Table t2, unlike table t1, should be displayed as pulled out explain extended select * from t0 where t0.a in ( select t1.a from t1,t2 where t2.a=t0.a and t1.b=t2.b); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 5 100.00 Using where -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2); Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY t1 NULL ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2); Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` @@ -629,10 +629,10 @@ create table t3 (pk int, a int, primary key(pk)); insert into t3 select a,a from t0; explain select * from t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t3)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY t2 hash_ALL NULL #hash#$hj 5 test.t1.a 3 Using where; Using join buffer (flat, BNLH join) -2 MATERIALIZED t3 index PRIMARY PRIMARY 4 NULL 10 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY t2 NULL hash_ALL NULL #hash#$hj 5 test.t1.a 3 Using where; Using join buffer (flat, BNLH join) +2 MATERIALIZED t3 NULL index PRIMARY PRIMARY 4 NULL 10 Using index drop table t0, t1, t2, t3; create table t1 (a int); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -743,10 +743,10 @@ insert into t3 select @a:=@a+1, t2.a from t2, t0; alter table t3 add primary key(id), add key(a); The following must use loose index scan over t3, key a: explain select count(a) from t2 where a in ( SELECT a FROM t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index a a 5 NULL 1000 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t3 index a a 5 NULL 30000 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index a a 5 NULL 1000 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t3 NULL index a a 5 NULL 30000 Using index select count(a) from t2 where a in ( SELECT a FROM t3); count(a) 1000 @@ -757,8 +757,8 @@ BUG#42740: crash in optimize_semijoin_nests create table t1 (c6 timestamp,key (c6)) engine=innodb; create table t2 (c2 double) engine=innodb; explain select 1 from t2 where c2 = any (select log10(null) from t1 where c6 <null) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables drop table t1, t2; # # BUG#42742: crash in setup_sj_materialization, Copy_field::set @@ -770,12 +770,12 @@ create table t2 (c1 tinytext,c2 text,c6 timestamp) engine=innodb; explain select 1 from t2 where c2 in (select 1 from t3, t2) and c1 in (select convert(c6,char(1)) from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 FirstMatch((sj-nest)); Using join buffer (incremental, BNL join) -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 FirstMatch((sj-nest)); Using join buffer (incremental, BNL join) +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 drop table t2, t3; # # BUG#761598: InnoDB: Error: row_search_for_mysql() is called without ha_innobase::external_lock() in maria-5.3 @@ -838,11 +838,11 @@ test.t3 analyze status OK explain SELECT * FROM t3 WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 const PRIMARY PRIMARY 4 const # Using index -1 PRIMARY alias2 index f12 f12 7 NULL # Using index; LooseScan -1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2) -1 PRIMARY t3 ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL const PRIMARY PRIMARY 4 const # Using index +1 PRIMARY alias2 NULL index f12 f12 7 NULL # Using index; LooseScan +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join) SELECT * FROM t3 WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24); f12 @@ -909,13 +909,13 @@ CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; EXPLAIN SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a WHERE t3.b IN (SELECT b FROM t4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t2 hash_ALL NULL #hash#$hj 4 test.t3.a 1 Using where; Using join buffer (flat, BNLH join) -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join) -2 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 -3 DERIVED t1 ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t2 NULL hash_ALL NULL #hash#$hj 4 test.t3.a 1 Using where; Using join buffer (flat, BNLH join) +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join) +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 2 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 1 SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a WHERE t3.b IN (SELECT b FROM t4); a b b a @@ -969,11 +969,11 @@ SELECT * FROM t1 WHERE b IN ( SELECT d FROM t2, t1 WHERE a = d AND ( pk < 2 OR d = 'z' ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t1 ref b b 4 test.t2.d 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -2 MATERIALIZED t2 index_merge PRIMARY,d d,PRIMARY 4,4 NULL 2 Using sort_union(d,PRIMARY); Using where -2 MATERIALIZED t1 ref a a 5 test.t2.d 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 +1 PRIMARY t1 NULL ref b b 4 test.t2.d 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +2 MATERIALIZED t2 NULL index_merge PRIMARY,d d,PRIMARY 4,4 NULL 2 Using sort_union(d,PRIMARY); Using where +2 MATERIALIZED t1 NULL ref a a 5 test.t2.d 1 Using where; Using index SELECT * FROM t1 WHERE b IN ( SELECT d FROM t2, t1 WHERE a = d AND ( pk < 2 OR d = 'z' ) @@ -1042,11 +1042,11 @@ WHERE (a, a) IN (SELECT alias2.b, alias2.a FROM t1 AS alias1, t1 AS alias2 WHERE alias2.b = alias1.a AND (alias1.b >= alias1.a OR alias2.b = 'z')); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL a NULL NULL NULL 38 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -2 MATERIALIZED alias1 ALL a NULL NULL NULL 19 Using where -2 MATERIALIZED alias2 ref a a 4 test.alias1.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL a NULL NULL NULL 38 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED alias1 NULL ALL a NULL NULL NULL 19 Using where +2 MATERIALIZED alias2 NULL ref a a 4 test.alias1.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT * FROM t2 WHERE (a, a) IN (SELECT alias2.b, alias2.a FROM t1 AS alias1, t1 AS alias2 WHERE @@ -1138,12 +1138,12 @@ SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 WHERE alias5.b = alias4.b AND ( alias5.b >= alias3.b OR alias5.c != alias3.c ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL # Using where -1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d # Using index -1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) -1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) -1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias3 NULL ALL PRIMARY NULL NULL NULL # Using where +1 PRIMARY alias4 NULL ref PRIMARY,c c 4 test.alias3.d # Using index +1 PRIMARY alias5 NULL eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL # Using join buffer (incremental, BNL join) SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 WHERE alias3.d IN ( SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 @@ -1159,12 +1159,12 @@ SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 WHERE alias5.b = alias4.b AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL # Using where -1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d # Using index -1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) -1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) -1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias3 NULL ALL PRIMARY NULL NULL NULL # Using where +1 PRIMARY alias4 NULL ref PRIMARY,c c 4 test.alias3.d # Using index +1 PRIMARY alias5 NULL eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL # Using join buffer (incremental, BNL join) SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 WHERE alias3.d IN ( SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 @@ -1201,9 +1201,9 @@ CREATE TABLE t3 (c INT, INDEX(c)) engine=innodb; INSERT INTO t2 VALUES (4),(5); explain SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL No matching min/max row SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) ); a DROP TABLE t1,t2,t3; @@ -1223,11 +1223,11 @@ SELECT * FROM t1, t3 WHERE t3_c IN ( SELECT t1_pk2 FROM t4, t2 WHERE t2_c = t1_p t1_pk1 t1_pk2 t3_i t3_c explain SELECT * FROM t1, t3 WHERE t3_c IN ( SELECT t1_pk2 FROM t4, t2 WHERE t2_c = t1_pk2 AND t2_i >= t3_i ) AND ( t1_pk1 = 'POL' ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref PRIMARY PRIMARY 5 const 1 Using where; Using index -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY t4 hash_index NULL #hash#$hj:PRIMARY 54:59 test.t3.t3_c 2 Using where; Using index; End temporary; Using join buffer (incremental, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref PRIMARY PRIMARY 5 const 1 Using where; Using index +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY t4 NULL hash_index NULL #hash#$hj:PRIMARY 54:59 test.t3.t3_c 2 Using where; Using index; End temporary; Using join buffer (incremental, BNLH join) DROP TABLE t1,t2,t3,t4; # # MDEV-6263: Wrong result when using IN subquery with order by @@ -1344,11 +1344,11 @@ ON T2_1_.t1idref=T1_1_.t1id WHERE T3_0_.t3idref= 1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY T3_0_ ref PRIMARY,FK_T3_T2Id PRIMARY 8 const 3 Using index; Start temporary -1 PRIMARY T2_1_ eq_ref PRIMARY,FK_T2_T1Id PRIMARY 8 test.T3_0_.t2idref 1 Using join buffer (flat, BKA join); Key-ordered scan -1 PRIMARY T1_1_ eq_ref PRIMARY PRIMARY 8 test.T2_1_.t1idref 1 Using index -1 PRIMARY T2_0_ ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY T3_0_ NULL ref PRIMARY,FK_T3_T2Id PRIMARY 8 const 3 Using index; Start temporary +1 PRIMARY T2_1_ NULL eq_ref PRIMARY,FK_T2_T1Id PRIMARY 8 test.T3_0_.t2idref 1 Using join buffer (flat, BKA join); Key-ordered scan +1 PRIMARY T1_1_ NULL eq_ref PRIMARY PRIMARY 8 test.T2_1_.t1idref 1 Using index +1 PRIMARY T2_0_ NULL ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary drop table t3,t2,t1; set optimizer_search_depth=@tmp7474; # @@ -1424,12 +1424,12 @@ SET SESSION join_cache_level=2; EXPLAIN SELECT t3.* FROM t1 JOIN t3 ON t3.b = t1.b WHERE c IN (SELECT t4.b FROM t4 JOIN t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 1 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t1 ref b b 4 test.t3.b 1 Using index -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 1 -2 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t1 NULL ref b b 4 test.t3.b 1 Using index +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) SELECT t3.* FROM t1 JOIN t3 ON t3.b = t1.b WHERE c IN (SELECT t4.b FROM t4 JOIN t2); b c @@ -1453,12 +1453,12 @@ SET optimizer_switch = 'semijoin_with_cache=on'; SET join_cache_level = 2; EXPLAIN SELECT * FROM t1, t2 WHERE b IN (SELECT a FROM t3, t4 WHERE b = pk); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 MATERIALIZED t4 ALL NULL NULL NULL NULL 1 Using where -2 MATERIALIZED t3 eq_ref PRIMARY PRIMARY 4 test.t4.b 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 1 Using where +2 MATERIALIZED t3 NULL eq_ref PRIMARY PRIMARY 4 test.t4.b 1 SELECT * FROM t1, t2 WHERE b IN (SELECT a FROM t3, t4 WHERE b = pk); pk a b 1 6 8 @@ -1478,19 +1478,19 @@ SET optimizer_switch = 'semijoin_with_cache=on'; SET join_cache_level = 3; EXPLAIN SELECT * FROM t1 WHERE b IN (SELECT a FROM t2 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 SELECT * FROM t1 WHERE b IN (SELECT a FROM t2 GROUP BY a); a b v v EXPLAIN SELECT * FROM t1 WHERE b IN (SELECT max(a) FROM t2 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 1 Using where -1 PRIMARY <subquery2> hash_ALL distinct_key #hash#distinct_key 4 test.t1.b 1 Using join buffer (flat, BNLH join) -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 1 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 1 Using where +1 PRIMARY <subquery2> NULL hash_ALL distinct_key #hash#distinct_key 4 test.t1.b 1 Using join buffer (flat, BNLH join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 Using temporary SELECT * FROM t1 WHERE b IN (SELECT max(a) FROM t2 GROUP BY a); a b v v diff --git a/mysql-test/main/subselect_sj2_mat.result b/mysql-test/main/subselect_sj2_mat.result index 9b497ade58b..aee2dbacc15 100644 --- a/mysql-test/main/subselect_sj2_mat.result +++ b/mysql-test/main/subselect_sj2_mat.result @@ -55,10 +55,10 @@ a b 18 13 19 14 explain select * from t2 where b in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL b NULL NULL NULL 20 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL b NULL NULL NULL 20 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 select * from t2 where b in (select a from t1); a b 1 1 @@ -83,10 +83,10 @@ test.t2 analyze status OK test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK explain select * from t3 where b in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL b NULL NULL NULL 20 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL b NULL NULL NULL 20 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 select * from t3 where b in (select a from t1); a b pk1 pk2 pk3 1 1 1 1 1 @@ -109,10 +109,10 @@ insert into t3 select A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a from t0 A, t0 B where B.a <5; explain select * from t3 where b in (select a from t0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL b NULL NULL NULL # -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func # -2 MATERIALIZED t0 ALL NULL NULL NULL NULL # +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL b NULL NULL NULL # +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func # +2 MATERIALIZED t0 NULL ALL NULL NULL NULL NULL # select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5); a b pk1 pk2 0 0 0 0 @@ -132,10 +132,10 @@ a b pk1 pk2 set join_buffer_size= @save_join_buffer_size; set max_heap_table_size= @save_max_heap_table_size; explain select * from t1 where a in (select b from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 index b b 5 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL index b b 5 NULL 20 Using index select * from t1; a b 1 1 @@ -161,10 +161,10 @@ insert into t2 values (19, 'duplicate ok', 'duplicate ok'); explain select a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z from t1 ot where a in (select a from t2 it); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot ALL NULL NULL NULL NULL 32 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it ALL NULL NULL NULL NULL 22 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 32 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 22 select a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z from t1 ot where a in (select a from t2 it); @@ -194,10 +194,10 @@ a mid(filler1, 1,10) Z explain select a, mid(filler1, 1,10), length(filler1)=length(filler2) from t2 ot where a in (select a from t1 it); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot ALL NULL NULL NULL NULL 22 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it ALL NULL NULL NULL NULL 32 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 22 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 32 select a, mid(filler1, 1,10), length(filler1)=length(filler2) from t2 ot where a in (select a from t1 it); @@ -229,10 +229,10 @@ insert into t1 select a+20, 'filler123456', 'filler123456' from t0; explain select a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z from t1 ot where a in (select a from t2 it); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot ALL NULL NULL NULL NULL 52 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it ALL NULL NULL NULL NULL 22 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 52 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 22 select a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z from t1 ot where a in (select a from t2 it); @@ -262,10 +262,10 @@ a mid(filler1, 1,10) Z explain select a, mid(filler1, 1,10), length(filler1)=length(filler2) from t2 ot where a in (select a from t1 it); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot ALL NULL NULL NULL NULL 22 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it ALL NULL NULL NULL NULL 52 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 22 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 52 select a, mid(filler1, 1,10), length(filler1)=length(filler2) from t2 ot where a in (select a from t1 it); @@ -303,12 +303,12 @@ t2 and t3 must be use 'ref', not 'ALL': explain select * from t0 where a in (select t2.a+t3.a from t1 left join (t2 join t3) on t2.a=t1.a and t3.a=t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 10 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func 1 Using where -2 MATERIALIZED t1 range a a 5 NULL 10 Using where; Using index -2 MATERIALIZED t2 ref a a 5 test.t1.a 1 Using index -2 MATERIALIZED t3 ref a a 5 test.t1.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 10 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func 1 Using where +2 MATERIALIZED t1 NULL range a a 5 NULL 10 Using where; Using index +2 MATERIALIZED t2 NULL ref a a 5 test.t1.a 1 Using index +2 MATERIALIZED t3 NULL ref a a 5 test.t1.a 1 Using index drop table t0, t1,t2,t3; CREATE TABLE t1 ( ID int(11) NOT NULL auto_increment, @@ -345,10 +345,10 @@ AND t2.Code IN (SELECT Country FROM t3 WHERE Language='English' AND Percentage > 10 AND t2.Population > 100000); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range Population,Country Population 4 NULL 1 Using index condition; Rowid-ordered scan; Start temporary -1 PRIMARY t2 eq_ref PRIMARY,Population PRIMARY 3 test.t1.Country 1 Using where; End temporary -1 PRIMARY t3 eq_ref PRIMARY,Percentage PRIMARY 33 test.t1.Country,const 1 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range Population,Country Population 4 NULL 1 Using index condition; Rowid-ordered scan; Start temporary +1 PRIMARY t2 NULL eq_ref PRIMARY,Population PRIMARY 3 test.t1.Country 1 Using where; End temporary +1 PRIMARY t3 NULL eq_ref PRIMARY,Percentage PRIMARY 33 test.t1.Country,const 1 Using index condition; Using where set optimizer_switch=@bug35674_save_optimizer_switch; DROP TABLE t1,t2,t3; CREATE TABLE t1 ( @@ -383,10 +383,10 @@ This must not use LooseScan: EXPLAIN SELECT Name FROM t1 WHERE t1.Code IN ( SELECT t2.CountryCode FROM t2 WHERE Population > 5000000); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 31 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 3 func 1 -2 MATERIALIZED t2 ALL CountryCode NULL NULL NULL 545 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 31 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 +2 MATERIALIZED t2 NULL ALL CountryCode NULL NULL NULL 545 Using where SELECT Name FROM t1 WHERE t1.Code IN ( SELECT t2.CountryCode FROM t2 WHERE Population > 5000000); @@ -466,10 +466,10 @@ Table t2, unlike table t1, should be displayed as pulled out explain extended select * from t0 where t0.a in ( select t1.a from t1,t2 where t2.a=t0.a and t1.b=t2.b); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 5 100.00 Using where -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 -1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 +1 PRIMARY t1 NULL ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2) Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` @@ -618,10 +618,10 @@ create table t3 (pk int, a int, primary key(pk)); insert into t3 select a,a from t0; explain select * from t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t3)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 Using where -2 MATERIALIZED t3 index PRIMARY PRIMARY 4 NULL 10 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 Using where +2 MATERIALIZED t3 NULL index PRIMARY PRIMARY 4 NULL 10 Using index drop table t0, t1, t2, t3; create table t1 (a int); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -732,10 +732,10 @@ insert into t3 select @a:=@a+1, t2.a from t2, t0; alter table t3 add primary key(id), add key(a); The following must use loose index scan over t3, key a: explain select count(a) from t2 where a in ( SELECT a FROM t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index a a 5 NULL 1000 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t3 index a a 5 NULL 30000 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index a a 5 NULL 1000 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t3 NULL index a a 5 NULL 30000 Using index select count(a) from t2 where a in ( SELECT a FROM t3); count(a) 1000 @@ -746,8 +746,8 @@ BUG#42740: crash in optimize_semijoin_nests create table t1 (c6 timestamp,key (c6)) engine=innodb; create table t2 (c2 double) engine=innodb; explain select 1 from t2 where c2 = any (select log10(null) from t1 where c6 <null) ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables drop table t1, t2; # # BUG#42742: crash in setup_sj_materialization, Copy_field::set @@ -759,12 +759,12 @@ create table t2 (c1 tinytext,c2 text,c6 timestamp) engine=innodb; explain select 1 from t2 where c2 in (select 1 from t3, t2) and c1 in (select convert(c6,char(1)) from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 FirstMatch((sj-nest)) -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 FirstMatch((sj-nest)) +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 drop table t2, t3; # # BUG#761598: InnoDB: Error: row_search_for_mysql() is called without ha_innobase::external_lock() in maria-5.3 @@ -827,11 +827,11 @@ test.t3 analyze status OK explain SELECT * FROM t3 WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 const PRIMARY PRIMARY 4 const # Using index -1 PRIMARY alias2 index f12 f12 7 NULL # Using index; LooseScan -1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2) -1 PRIMARY t3 ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL const PRIMARY PRIMARY 4 const # Using index +1 PRIMARY alias2 NULL index f12 f12 7 NULL # Using index; LooseScan +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join) SELECT * FROM t3 WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24); f12 @@ -898,13 +898,13 @@ CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; EXPLAIN SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a WHERE t3.b IN (SELECT b FROM t4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 -2 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 -3 DERIVED t1 ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 2 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 1 SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a WHERE t3.b IN (SELECT b FROM t4); a b b a @@ -958,11 +958,11 @@ SELECT * FROM t1 WHERE b IN ( SELECT d FROM t2, t1 WHERE a = d AND ( pk < 2 OR d = 'z' ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t1 ref b b 4 test.t2.d 1 -2 MATERIALIZED t2 index_merge PRIMARY,d d,PRIMARY 4,4 NULL 2 Using sort_union(d,PRIMARY); Using where -2 MATERIALIZED t1 ref a a 5 test.t2.d 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 +1 PRIMARY t1 NULL ref b b 4 test.t2.d 1 +2 MATERIALIZED t2 NULL index_merge PRIMARY,d d,PRIMARY 4,4 NULL 2 Using sort_union(d,PRIMARY); Using where +2 MATERIALIZED t1 NULL ref a a 5 test.t2.d 1 Using where; Using index SELECT * FROM t1 WHERE b IN ( SELECT d FROM t2, t1 WHERE a = d AND ( pk < 2 OR d = 'z' ) @@ -1031,11 +1031,11 @@ WHERE (a, a) IN (SELECT alias2.b, alias2.a FROM t1 AS alias1, t1 AS alias2 WHERE alias2.b = alias1.a AND (alias1.b >= alias1.a OR alias2.b = 'z')); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL a NULL NULL NULL 38 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -2 MATERIALIZED alias1 ALL a NULL NULL NULL 19 Using where -2 MATERIALIZED alias2 ref a a 4 test.alias1.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL a NULL NULL NULL 38 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED alias1 NULL ALL a NULL NULL NULL 19 Using where +2 MATERIALIZED alias2 NULL ref a a 4 test.alias1.a 1 Using where SELECT * FROM t2 WHERE (a, a) IN (SELECT alias2.b, alias2.a FROM t1 AS alias1, t1 AS alias2 WHERE @@ -1127,12 +1127,12 @@ SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 WHERE alias5.b = alias4.b AND ( alias5.b >= alias3.b OR alias5.c != alias3.c ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL # Using where -1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d # Using index -1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) -1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) -1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias3 NULL ALL PRIMARY NULL NULL NULL # Using where +1 PRIMARY alias4 NULL ref PRIMARY,c c 4 test.alias3.d # Using index +1 PRIMARY alias5 NULL eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 WHERE alias3.d IN ( SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 @@ -1148,12 +1148,12 @@ SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 WHERE alias5.b = alias4.b AND ( alias5.b >= alias3.b OR alias3.c != alias5.c ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias3 ALL PRIMARY NULL NULL NULL # Using where -1 PRIMARY alias4 ref PRIMARY,c c 4 test.alias3.d # Using index -1 PRIMARY alias5 eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) -1 PRIMARY alias2 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) -1 PRIMARY alias1 ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias3 NULL ALL PRIMARY NULL NULL NULL # Using where +1 PRIMARY alias4 NULL ref PRIMARY,c c 4 test.alias3.d # Using index +1 PRIMARY alias5 NULL eq_ref PRIMARY PRIMARY 4 test.alias4.b # Using where; FirstMatch(alias3) +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3 WHERE alias3.d IN ( SELECT alias4.c FROM t2 AS alias4, t2 AS alias5 @@ -1190,9 +1190,9 @@ CREATE TABLE t3 (c INT, INDEX(c)) engine=innodb; INSERT INTO t2 VALUES (4),(5); explain SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL No matching min/max row +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL No matching min/max row SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) ); a DROP TABLE t1,t2,t3; @@ -1212,11 +1212,11 @@ SELECT * FROM t1, t3 WHERE t3_c IN ( SELECT t1_pk2 FROM t4, t2 WHERE t2_c = t1_p t1_pk1 t1_pk2 t3_i t3_c explain SELECT * FROM t1, t3 WHERE t3_c IN ( SELECT t1_pk2 FROM t4, t2 WHERE t2_c = t1_pk2 AND t2_i >= t3_i ) AND ( t1_pk1 = 'POL' ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ref PRIMARY PRIMARY 5 const 1 Using where; Using index -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Start temporary -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t4 index NULL PRIMARY 59 NULL 2 Using where; Using index; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ref PRIMARY PRIMARY 5 const 1 Using where; Using index +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t4 NULL index NULL PRIMARY 59 NULL 2 Using where; Using index; End temporary DROP TABLE t1,t2,t3,t4; # # MDEV-6263: Wrong result when using IN subquery with order by @@ -1333,11 +1333,11 @@ ON T2_1_.t1idref=T1_1_.t1id WHERE T3_0_.t3idref= 1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY T3_0_ ref PRIMARY,FK_T3_T2Id PRIMARY 8 const 3 Using index; Start temporary -1 PRIMARY T2_1_ eq_ref PRIMARY,FK_T2_T1Id PRIMARY 8 test.T3_0_.t2idref 1 -1 PRIMARY T1_1_ eq_ref PRIMARY PRIMARY 8 test.T2_1_.t1idref 1 Using index -1 PRIMARY T2_0_ ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY T3_0_ NULL ref PRIMARY,FK_T3_T2Id PRIMARY 8 const 3 Using index; Start temporary +1 PRIMARY T2_1_ NULL eq_ref PRIMARY,FK_T2_T1Id PRIMARY 8 test.T3_0_.t2idref 1 +1 PRIMARY T1_1_ NULL eq_ref PRIMARY PRIMARY 8 test.T2_1_.t1idref 1 Using index +1 PRIMARY T2_0_ NULL ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 Using index; End temporary drop table t3,t2,t1; set optimizer_search_depth=@tmp7474; # @@ -1479,10 +1479,10 @@ SELECT count(*) FROM t1, t3 WHERE t1.cat_id = t3.cat_id AND t3.cat_id IN (SELECT cat_id FROM t2) AND t3.sack_id = 33479 AND t3.kit_id = 6; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ref PRIMARY PRIMARY 5 const,const 5 Using index -1 PRIMARY t2 ref cat_id cat_id 4 test.t3.cat_id 2 Using where; Using index; FirstMatch(t3) -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.cat_id 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ref PRIMARY PRIMARY 5 const,const 5 Using index +1 PRIMARY t2 NULL ref cat_id cat_id 4 test.t3.cat_id 2 Using where; Using index; FirstMatch(t3) +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.cat_id 1 Using where; Using index SELECT count(*) FROM t1, t3 WHERE t1.cat_id = t3.cat_id AND t3.cat_id IN (SELECT cat_id FROM t2) AND @@ -1495,11 +1495,11 @@ SELECT count(*) FROM t1, t3 WHERE t1.cat_id = t3.cat_id AND t3.cat_id IN (SELECT cat_id FROM t4) AND t3.sack_id = 33479 AND t3.kit_id = 6; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ref PRIMARY PRIMARY 5 const,const 5 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.cat_id 1 Using index -2 MATERIALIZED t4 index cat_id cat_id 4 NULL 19 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ref PRIMARY PRIMARY 5 const,const 5 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.cat_id 1 Using index +2 MATERIALIZED t4 NULL index cat_id cat_id 4 NULL 19 Using index SELECT count(*) FROM t1, t3 WHERE t1.cat_id = t3.cat_id AND t3.cat_id IN (SELECT cat_id FROM t4) AND @@ -1511,11 +1511,11 @@ SELECT count(*) FROM t1, t3 WHERE t1.cat_id = t3.cat_id AND t3.cat_id IN (SELECT cat_id FROM t2) AND t3.sack_id = 33479 AND t3.kit_id = 6; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ref PRIMARY PRIMARY 5 const,const 5 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 Using where -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.cat_id 1 Using index -2 MATERIALIZED t2 index cat_id cat_id 4 NULL 19 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ref PRIMARY PRIMARY 5 const,const 5 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.cat_id 1 Using index +2 MATERIALIZED t2 NULL index cat_id cat_id 4 NULL 19 Using index SELECT count(*) FROM t1, t3 WHERE t1.cat_id = t3.cat_id AND t3.cat_id IN (SELECT cat_id FROM t2) AND @@ -1541,11 +1541,11 @@ set optimizer_switch='materialization=off'; EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 ) WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Start temporary -1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t1 ref idx idx 2 test.t4.a4 1 100.00 Using index; End temporary -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Start temporary +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t1 NULL ref idx idx 2 test.t4.a4 1 100.00 Using index; End temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(`test`.`t2`.`a2` = `test`.`t4`.`a4`) where `test`.`t4`.`b4` = `test`.`t4`.`a4` and `test`.`t1`.`b1` = `test`.`t4`.`a4` SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 ) @@ -1559,12 +1559,12 @@ set optimizer_switch='materialization=on'; EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 ) WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 100.00 -1 PRIMARY t1 ref idx idx 2 test.t4.a4 1 100.00 Using index -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 -2 MATERIALIZED t4 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 3 100.00 +1 PRIMARY t1 NULL ref idx idx 2 test.t4.a4 1 100.00 Using index +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(`test`.`t1`.`b1` = `test`.`t4`.`a4` and `test`.`t2`.`a2` = `test`.`t4`.`a4`) where `test`.`t4`.`b4` = `test`.`t4`.`a4` and `test`.`t1`.`b1` = `test`.`t4`.`a4` SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 ) @@ -1595,11 +1595,11 @@ set optimizer_switch='materialization=off'; EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 10 100.00 Using where; End temporary; Using join buffer (flat, BNL join) -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; End temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(`test`.`t2`.`c2` = `test`.`t1`.`c1` or `test`.`t1`.`c1` > 'z') where `test`.`t4`.`c4` = `test`.`t1`.`c1` and `test`.`t3`.`c3` = `test`.`t1`.`c1` SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') @@ -1612,12 +1612,12 @@ set optimizer_switch='materialization=on'; EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 100.00 -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(`test`.`t2`.`c2` = `test`.`t1`.`c1` or `test`.`t1`.`c1` > 'z') where `test`.`t3`.`c3` = `test`.`t4`.`c4` SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') @@ -1644,10 +1644,10 @@ set join_cache_level=3; set optimizer_switch='materialization=off,semijoin=off'; EXPLAIN EXTENDED SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t3 hash_ALL NULL #hash#$hj 5 func 3 100.00 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t3 NULL hash_ALL NULL #hash#$hj 5 func 3 100.00 Using where; Using join buffer (flat, BNLH join) Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`i1` AS `i1` from `test`.`t1` where <expr_cache><`test`.`t1`.`i1`>(<in_optimizer>(`test`.`t1`.`i1`,<exists>(/* select#2 */ select `test`.`t3`.`i3` from `test`.`t2` join `test`.`t3` where `test`.`t3`.`i3` = `test`.`t2`.`i2` and <cache>(`test`.`t1`.`i1`) = `test`.`t3`.`i3`))) SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2); @@ -1656,11 +1656,11 @@ i1 set optimizer_switch='materialization=on,semijoin=on'; EXPLAIN EXTENDED SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 MATERIALIZED t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED t3 NULL hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join) Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where `test`.`t3`.`i3` = `test`.`t2`.`i2` SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2); @@ -1669,11 +1669,11 @@ i1 EXPLAIN EXTENDED SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Using where -2 MATERIALIZED t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED t3 NULL hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join) Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t3`.`i3` > 0 SELECT * FROM t1 @@ -1701,10 +1701,10 @@ select * from t1 where (rand() < 0) and i in (select i from t2); i explain extended select * from t1 where (rand() < 0) and i in (select i from t2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 10 100.00 Warnings: Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1` semi join (`test`.`t2`) where rand() < 0 drop table t1,t2; @@ -1726,10 +1726,10 @@ explain SELECT f1 FROM t1 WHERE f1 IN ( SELECT f2 FROM t2 WHERE f2 > 'bar' ) HAVING f1 != 'foo' ORDER BY f1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range f1 f1 11 NULL 2 Using where; Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 11 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range f1 f1 11 NULL 2 Using where; Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 11 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 Using where DROP TABLE t1,t2; # # MDEV-16225: wrong resultset from query with semijoin=on @@ -1766,11 +1766,11 @@ t.id IN (SELECT A.id FROM t1 AS A WHERE A.local_name IN (SELECT B.local_name FRO OR (t.id IN (0,4,12,13,1,10,3,11)) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t index PRIMARY PRIMARY 4 NULL 114 Using where; Using index -2 MATERIALIZED A ALL PRIMARY NULL NULL NULL 114 -2 MATERIALIZED <subquery3> eq_ref distinct_key distinct_key 67 func 1 -3 MATERIALIZED B range PRIMARY PRIMARY 4 NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL index PRIMARY PRIMARY 4 NULL 114 Using where; Using index +2 MATERIALIZED A NULL ALL PRIMARY NULL NULL NULL 114 +2 MATERIALIZED <subquery3> NULL eq_ref distinct_key distinct_key 67 func 1 +3 MATERIALIZED B NULL range PRIMARY PRIMARY 4 NULL 8 Using where SELECT SQL_NO_CACHE t.id FROM t1 t WHERE ( @@ -1825,12 +1825,12 @@ INSERT INTO `t3` VALUES explain SELECT t2.id FROM t2,t1 WHERE t2.id IN (SELECT t3.ref_id FROM t3,t1 where t3.id = t1.id) and t2.id = t1.id; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 30 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 Using where -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.id 1 Using index -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 14 -2 MATERIALIZED t1 eq_ref PRIMARY PRIMARY 4 test.t3.id 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 30 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.id 1 Using index +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 14 +2 MATERIALIZED t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.id 1 Using index SELECT t2.id FROM t2,t1 WHERE t2.id IN (SELECT t3.ref_id FROM t3,t1 where t3.id = t1.id) and t2.id = t1.id; id @@ -1931,21 +1931,21 @@ AND t3.id_product IN (SELECT id_product FROM t2 t2_2 WHERE t2_2.id_t2 = 15) AND t3.id_product IN (SELECT id_product FROM t2 t2_3 WHERE t2_3.id_t2 = 18 OR t2_3.id_t2 = 19) AND t3.id_product IN (SELECT id_product FROM t2 t2_4 WHERE t2_4.id_t2 = 34 OR t2_4.id_t2 = 23) AND t3.id_product IN (SELECT id_product FROM t2 t2_5 WHERE t2_5.id_t2 = 29 OR t2_5.id_t2 = 28 OR t2_5.id_t2 = 26); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 18 Using index -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 Using where -1 PRIMARY t5 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 func 1 Using where -1 PRIMARY <subquery6> eq_ref distinct_key distinct_key 4 func 1 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 Using where -1 PRIMARY t4 eq_ref PRIMARY PRIMARY 8 test.t3.id_product,const 1 Using where; Using index -1 PRIMARY <subquery5> eq_ref distinct_key distinct_key 4 func 1 Using where -1 PRIMARY t1 index NULL PRIMARY 8 NULL 73 Using where; Using index; Using join buffer (flat, BNL join) -3 MATERIALIZED t2_2 ref id_t2,id_product id_t2 5 const 12 -4 MATERIALIZED t2_3 range id_t2,id_product id_t2 5 NULL 33 Using index condition; Using where -6 MATERIALIZED t2_5 range id_t2,id_product id_t2 5 NULL 31 Using index condition; Using where -2 MATERIALIZED t2_1 ALL id_t2,id_product NULL NULL NULL 223 Using where -5 MATERIALIZED t2_4 range id_t2,id_product id_t2 5 NULL 18 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL index PRIMARY PRIMARY 4 NULL 18 Using index +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY t5 NULL ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <subquery4> NULL eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY <subquery6> NULL eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY t4 NULL eq_ref PRIMARY PRIMARY 8 test.t3.id_product,const 1 Using where; Using index +1 PRIMARY <subquery5> NULL eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY t1 NULL index NULL PRIMARY 8 NULL 73 Using where; Using index; Using join buffer (flat, BNL join) +3 MATERIALIZED t2_2 NULL ref id_t2,id_product id_t2 5 const 12 +4 MATERIALIZED t2_3 NULL range id_t2,id_product id_t2 5 NULL 33 Using index condition; Using where +6 MATERIALIZED t2_5 NULL range id_t2,id_product id_t2 5 NULL 31 Using index condition; Using where +2 MATERIALIZED t2_1 NULL ALL id_t2,id_product NULL NULL NULL 223 Using where +5 MATERIALIZED t2_4 NULL range id_t2,id_product id_t2 5 NULL 18 Using index condition; Using where set optimizer_switch='rowid_filter=default'; drop table t1,t2,t3,t4,t5; set global innodb_stats_persistent= @innodb_stats_persistent_save; diff --git a/mysql-test/main/subselect_sj_jcl6.result b/mysql-test/main/subselect_sj_jcl6.result index e97c1d5e915..daf97cc008b 100644 --- a/mysql-test/main/subselect_sj_jcl6.result +++ b/mysql-test/main/subselect_sj_jcl6.result @@ -31,9 +31,9 @@ create table t12 like t10; insert into t12 select * from t10; Flattened because of dependency, t10=func(t1) explain select * from t1 where a in (select pk from t10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index select * from t1 where a in (select pk from t10); a b 0 0 @@ -41,27 +41,27 @@ a b 2 2 A confluent case of dependency explain select * from t1 where a in (select a from t10 where pk=12); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables select * from t1 where a in (select a from t10 where pk=12); a b explain select * from t1 where a in (select a from t10 where pk=9); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t10 const PRIMARY PRIMARY 4 const 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t10 NULL const PRIMARY PRIMARY 4 const 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where select * from t1 where a in (select a from t10 where pk=9); a b An empty table inside explain select * from t1 where a in (select a from t11); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables select * from t1 where a in (select a from t11); a b explain select * from t1 where a in (select pk from t10) and b in (select pk from t10); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index -1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index +1 PRIMARY t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using index select * from t1 where a in (select pk from t10) and b in (select pk from t10); a b 0 0 @@ -69,10 +69,10 @@ a b 2 2 flattening a nested subquery explain select * from t1 where a in (select pk from t10 where t10.a in (select pk from t12)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 PRIMARY t12 eq_ref PRIMARY PRIMARY 4 test.t10.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY t12 NULL eq_ref PRIMARY PRIMARY 4 test.t10.a 1 Using index select * from t1 where a in (select pk from t10 where t10.a in (select pk from t12)); a b 0 0 @@ -80,29 +80,29 @@ a b 2 2 flattening subquery w/ several tables explain extended select * from t1 where a in (select t10.pk from t10, t12 where t12.pk=t10.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 PRIMARY t12 eq_ref PRIMARY PRIMARY 4 test.t10.a 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY t12 NULL eq_ref PRIMARY PRIMARY 4 test.t10.a 1 100.00 Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where `test`.`t12`.`pk` = `test`.`t10`.`a` and `test`.`t10`.`pk` = `test`.`t1`.`a` subqueries within outer joins go into ON expr. explAin extended select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY A ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (flAt, BNL join) -1 PRIMARY B ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (incrementAl, BNL join) -2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index +id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY A NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (flAt, BNL join) +1 PRIMARY B NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (incrementAl, BNL join) +2 MATERIALIZED t10 NULL index PRIMARY PRIMARY 4 NULL 10 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(`test`.`A`.`A` = `test`.`t1`.`A` And <in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (/* select#2 */ select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where `test`.`B`.`A` = `<suBquery2>`.`pk`)))) where 1 t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" explAin extended select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (flAt, BNL join) -2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index +id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (flAt, BNL join) +2 MATERIALIZED t10 NULL index PRIMARY PRIMARY 4 NULL 10 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`A` = `test`.`t1`.`A` And <in_optimizer>(`test`.`t1`.`A`,`test`.`t1`.`A` in ( <mAteriAlize> (/* select#2 */ select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t1`.`A` in <temporAry tABle> on distinct_key where `test`.`t1`.`A` = `<suBquery2>`.`pk`)))) where 1 set @save_join_buffer_size=@@join_buffer_size; @@ -120,77 +120,77 @@ select m00.a from t1 m00, t1 m01, t1 m02, t1 m03, t1 m04,t1 m05,t1 m06,t1 m07,t1 m08,t1 m09, t1 m10, t1 m11, t1 m12, t1 m13, t1 m14,t1 m15,t1 m16,t1 m17,t1 m18,t1 m19 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY s00 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY s01 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY s02 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s03 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s04 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s05 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s06 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s07 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s08 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s09 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s10 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s11 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s12 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s13 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s14 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s15 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s16 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s17 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s18 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s19 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s20 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s21 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s22 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s23 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s24 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s25 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s26 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s27 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s28 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s29 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s30 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s31 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s32 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s33 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s34 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s35 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s36 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s37 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s38 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s39 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s40 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s41 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s42 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s43 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s44 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s45 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s46 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s47 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s48 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -1 PRIMARY s49 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m00 ALL NULL NULL NULL NULL 3 Using where -2 DEPENDENT SUBQUERY m01 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY m02 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m03 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m04 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m05 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m06 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m07 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m08 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m09 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m10 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m11 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m12 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m13 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m14 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m15 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m16 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m17 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m18 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY m19 ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY s00 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY s01 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY s02 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s03 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s04 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s05 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s06 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s07 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s08 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s09 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s10 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s11 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s12 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s13 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s14 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s15 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s16 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s17 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s18 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s19 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s20 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s21 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s22 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s23 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s24 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s25 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s26 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s27 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s28 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s29 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s30 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s31 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s32 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s33 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s34 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s35 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s36 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s37 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s38 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s39 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s40 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s41 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s42 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s43 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s44 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s45 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s46 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s47 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s48 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +1 PRIMARY s49 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m00 NULL ALL NULL NULL NULL NULL 3 Using where +2 DEPENDENT SUBQUERY m01 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m02 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m03 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m04 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m05 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m06 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m07 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m08 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m09 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m10 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m11 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m12 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m13 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m14 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m15 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m16 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m17 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m18 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m19 NULL ALL NULL NULL NULL NULL 3 Using join buffer (incremental, BNL join) select * from t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t10)) where t1.a < 5; @@ -215,9 +215,9 @@ a b a b 2 2 2 2 insert into t1 select (A.a + 10 * B.a),1 from t0 A, t0 B; explain extended select * from t1 where a in (select pk from t10 where pk<3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t10 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index -1 PRIMARY t1 ALL NULL NULL NULL NULL 103 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t10 NULL range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 103 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t10`.`pk` and `test`.`t10`.`pk` < 3 drop table t0, t1, t2; @@ -353,10 +353,10 @@ WHERE EMPNUM IN (SELECT EMPNUM FROM WORKS WHERE PNUM IN (SELECT PNUM FROM PROJ)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY STAFF ALL NULL NULL NULL NULL 5 -1 PRIMARY PROJ ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) -1 PRIMARY WORKS ALL NULL NULL NULL NULL 12 Using where; FirstMatch(STAFF); Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY STAFF NULL ALL NULL NULL NULL NULL 5 +1 PRIMARY PROJ NULL ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) +1 PRIMARY WORKS NULL ALL NULL NULL NULL NULL 12 Using where; FirstMatch(STAFF); Using join buffer (incremental, BNL join) SELECT EMPNUM, EMPNAME FROM STAFF WHERE EMPNUM IN @@ -510,10 +510,10 @@ INSERT INTO t0 VALUES (1,'g','g'), (2,'v','v'), (3,'t','t'), (4,'u','u'), (5,'n','n'); EXPLAIN EXTENDED SELECT vkey FROM t0 WHERE pk IN (SELECT t1.pk FROM t0 t1 JOIN t0 t2 ON t2.vkey = t1.vnokey); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t0 ALL PRIMARY NULL NULL NULL 5 100.00 -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t0.pk 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 PRIMARY t2 ref vkey vkey 4 test.t1.vnokey 2 100.00 Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL PRIMARY NULL NULL NULL 5 100.00 +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t0.pk 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY t2 NULL ref vkey vkey 4 test.t1.vnokey 2 100.00 Using index; FirstMatch(t1) Warnings: Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where `test`.`t1`.`pk` = `test`.`t0`.`pk` and `test`.`t2`.`vkey` = `test`.`t1`.`vnokey` SELECT vkey FROM t0 WHERE pk IN @@ -740,11 +740,11 @@ EXPLAIN SELECT int_key FROM ot1 WHERE int_nokey IN (SELECT it2.int_key FROM it1 LEFT JOIN it2 ON it2.datetime_key); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot1 ALL NULL NULL NULL NULL 20 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED it1 index NULL int_key 4 NULL 2 Using index -2 MATERIALIZED it2 ALL int_key,datetime_key NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 20 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED it1 NULL index NULL int_key 4 NULL 2 Using index +2 MATERIALIZED it2 NULL ALL int_key,datetime_key NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) DROP TABLE ot1, it1, it2; # End of BUG#38075 # @@ -773,10 +773,10 @@ insert into t3 values (20); explain extended select a from t1 where a in (select c from t2 where d >= some(select e from t3 where b=e)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 7 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`c` = `test`.`t1`.`a` and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(/* select#3 */ select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and <cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`)))) @@ -814,19 +814,19 @@ INSERT INTO t1 VALUES (1,'o','ffff','ffff','ffoo','ffff','ffff','ffff','ffff','f CREATE TABLE t2 LIKE t1; INSERT INTO t2 VALUES (1,'i','iiii','iiii','iiii','iiii','ffff','ffff','ffff','ffff','ffff',GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))')), (2,'f','ffff','ffff','ffff','ffff','ffff','ffff','ffff','ffff','ffff',GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))')); EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 11 func,func 1 100.00 -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 11 func,func 1 100.00 +2 MATERIALIZED t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0); pk 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, c) IN (SELECT b, c FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`c` = `test`.`t1`.`c` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, c) IN (SELECT b, c FROM t2 WHERE pk > 0); @@ -834,18 +834,18 @@ pk 1 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, d) IN (SELECT b, d FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`d` = `test`.`t1`.`d` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, d) IN (SELECT b, d FROM t2 WHERE pk > 0); pk 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, e) IN (SELECT b, e FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`e` = `test`.`t1`.`e` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, e) IN (SELECT b, e FROM t2 WHERE pk > 0); @@ -853,9 +853,9 @@ pk 1 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, f) IN (SELECT b, f FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`f` = `test`.`t1`.`f` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, f) IN (SELECT b, f FROM t2 WHERE pk > 0); @@ -863,9 +863,9 @@ pk 1 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, g) IN (SELECT b, g FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`g` = `test`.`t1`.`g` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, g) IN (SELECT b, g FROM t2 WHERE pk > 0); @@ -873,9 +873,9 @@ pk 1 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, h) IN (SELECT b, h FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`h` = `test`.`t1`.`h` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, h) IN (SELECT b, h FROM t2 WHERE pk > 0); @@ -883,9 +883,9 @@ pk 1 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`i` = `test`.`t1`.`i` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0); @@ -893,9 +893,9 @@ pk 1 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, j) IN (SELECT b, j FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`j` = `test`.`t1`.`j` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, j) IN (SELECT b, j FROM t2 WHERE pk > 0); @@ -903,9 +903,9 @@ pk 1 2 EXPLAIN EXTENDED SELECT pk FROM t1 WHERE (b, k) IN (SELECT b, k FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`b` and `test`.`t2`.`k` = `test`.`t1`.`k` and `test`.`t2`.`pk` > 0 SELECT pk FROM t1 WHERE (b, k) IN (SELECT b, k FROM t2 WHERE pk > 0); @@ -949,15 +949,15 @@ WHERE t1field IN (SELECT * FROM v2) AND t1field IN (SELECT * FROM v3) "; EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 Using index -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 Using index +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index EXECUTE stmt; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 Using index -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 Using index +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 Using index DROP TABLE t1, t2, t3; DROP VIEW v2, v3; # End of Bug#49198 @@ -983,10 +983,10 @@ WHERE ( `varchar_nokey` , `varchar_nokey` ) IN ( SELECT `varchar_key` , `varchar_nokey` FROM t1 WHERE `varchar_nokey` < 'n' XOR `pk` ) ; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 18 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00 -2 MATERIALIZED t1 ALL varchar_key NULL NULL NULL 15 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 18 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED t1 NULL ALL varchar_key NULL NULL NULL 15 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`varchar_nokey` AS `varchar_nokey` from `test`.`t2` semi join (`test`.`t1`) where `test`.`t1`.`varchar_nokey` = `test`.`t1`.`varchar_key` and (`test`.`t1`.`varchar_key` < 'n' xor `test`.`t1`.`pk`) SELECT varchar_nokey @@ -1065,12 +1065,12 @@ WHERE t1.val IN (SELECT t2.val FROM t2 WHERE t2.val LIKE 'a%' OR t2.val LIKE 'e%') AND t1.val IN (SELECT t3.val FROM t3 WHERE t3.val LIKE 'a%' OR t3.val LIKE 'e%'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 13 func 1 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 13 func 1 -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 5 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 13 func 1 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 13 func 1 +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 5 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 Using where SELECT * FROM t1 WHERE t1.val IN (SELECT t2.val FROM t2 @@ -1259,9 +1259,9 @@ CREATE TABLE t2 (i INTEGER, j INTEGER, KEY k(i, j)); INSERT INTO t2 VALUES (1, 0), (1, 1), (2, 0), (2, 1); EXPLAIN SELECT * FROM t1 WHERE (i) IN (SELECT i FROM t2 where j > 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index k k 10 NULL 4 Using where; Using index; Start temporary -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index k k 10 NULL 4 Using where; Using index; Start temporary +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 Using where; End temporary; Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE (i) IN (SELECT i FROM t2 where j > 0); i 1 @@ -1316,10 +1316,10 @@ set optimizer_switch='materialization=off'; set optimizer_switch='semijoin=off'; explain select * from t1 where t1.a in (select t2.a from t2 left join t3 on t2.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 4 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) select * from t1 where t1.a in (select t2.a from t2 left join t3 on t2.a=t3.a); a 1 @@ -1327,10 +1327,10 @@ a set optimizer_switch='semijoin=on'; explain select * from t1 where t1.a in (select t2.a from t2 left join t3 on t2.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (incremental, BNL join) select * from t1 where t1.a in (select t2.a from t2 left join t3 on t2.a=t3.a); a 1 @@ -1352,11 +1352,11 @@ EXPLAIN SELECT * FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY t2inner ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2inner NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) SELECT * FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a); @@ -1368,11 +1368,11 @@ EXPLAIN SELECT * FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 -2 MATERIALIZED t2inner ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED t2inner NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (incremental, BNL join) SELECT * FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a); @@ -1384,11 +1384,11 @@ EXPLAIN SELECT * FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY t2inner ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2inner NULL ALL NULL NULL NULL NULL 2 Using join buffer (incremental, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (incremental, BNL join) SELECT * FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a); @@ -1456,11 +1456,11 @@ FROM ot1 LEFT JOIN (ot2 JOIN ot3 on ot2.a=ot3.a) ON ot1.a=ot2.a AND ot1.a IN (SELECT a from it1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot1 ALL NULL NULL NULL NULL 8 -1 PRIMARY ot3 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -1 PRIMARY ot2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (incremental, BNL join) -2 DEPENDENT SUBQUERY it1 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 8 +1 PRIMARY ot3 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +1 PRIMARY ot2 NULL ALL NULL NULL NULL NULL 4 Using where; Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY it1 NULL ALL NULL NULL NULL NULL 8 Using where SELECT * FROM ot1 LEFT JOIN @@ -1507,11 +1507,11 @@ FROM ot1 LEFT JOIN (ot2 JOIN ot3 on ot2.a=ot3.a) ON ot1.a=ot2.a AND ot1.a IN (SELECT a from it1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ot1 ALL NULL NULL NULL NULL 8 -1 PRIMARY ot3 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -1 PRIMARY ot2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (incremental, BNL join) -2 MATERIALIZED it1 ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 8 +1 PRIMARY ot3 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +1 PRIMARY ot2 NULL ALL NULL NULL NULL NULL 4 Using where; Using join buffer (incremental, BNL join) +2 MATERIALIZED it1 NULL ALL NULL NULL NULL NULL 8 SELECT * FROM ot1 LEFT JOIN @@ -1571,11 +1571,11 @@ EXPLAIN SELECT * FROM t3 WHERE f2 IN (SELECT t1.f1 FROM t1 LEFT OUTER JOIN (t2 AS b1 JOIN t2 AS b2 ON TRUE) ON TRUE); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 14 Using where -2 MATERIALIZED t1 system NULL NULL NULL NULL 1 -2 MATERIALIZED b1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED b2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 14 Using where +2 MATERIALIZED t1 NULL system NULL NULL NULL NULL 1 +2 MATERIALIZED b1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED b2 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t3 WHERE f2 IN (SELECT t1.f1 FROM t1 LEFT OUTER JOIN (t2 AS b1 JOIN t2 AS b2 ON TRUE) ON TRUE); @@ -1589,12 +1589,12 @@ EXPLAIN SELECT * FROM t3 WHERE f2 IN (SELECT t1.f1 FROM t1 LEFT OUTER JOIN (t2 AS b1 JOIN t2 AS b2 ON TRUE) ON TRUE); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 1 -1 PRIMARY t3 ALL NULL NULL NULL NULL 14 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED b1 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED b2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 1 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 14 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED b1 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED b2 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t3 WHERE f2 IN (SELECT t1.f1 FROM t1 LEFT OUTER JOIN (t2 AS b1 JOIN t2 AS b2 ON TRUE) ON TRUE); @@ -1619,11 +1619,11 @@ WHERE A.t1field IN (SELECT A.t1field FROM t2 B) AND A.t1field IN (SELECT C.t2field FROM t2 C WHERE C.t2field IN (SELECT D.t2field FROM t2 D)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A index PRIMARY PRIMARY 4 NULL 3 Using index -1 PRIMARY B index NULL PRIMARY 4 NULL 3 Using index; FirstMatch(A); Using join buffer (flat, BNL join) -1 PRIMARY C eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 Using index -1 PRIMARY D eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL index PRIMARY PRIMARY 4 NULL 3 Using index +1 PRIMARY B NULL index NULL PRIMARY 4 NULL 3 Using index; FirstMatch(A); Using join buffer (flat, BNL join) +1 PRIMARY C NULL eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 Using index +1 PRIMARY D NULL eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 Using index SELECT * FROM t1 A WHERE A.t1field IN (SELECT A.t1field FROM t2 B) AND @@ -1648,13 +1648,13 @@ a a explain select * from t1 A, t1 B where A.a = B.a and A.a in (select a from t2 C) and B.a in (select a from t2 D); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY A ALL NULL NULL NULL NULL 3 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY B ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED C ALL NULL NULL NULL NULL 3 -3 MATERIALIZED D ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY B NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED C NULL ALL NULL NULL NULL NULL 3 +3 MATERIALIZED D NULL ALL NULL NULL NULL NULL 3 drop table t1, t2; # # BUG#784441: Abort on semijoin with a view as the inner table @@ -1666,11 +1666,11 @@ INSERT INTO t2 VALUES (1), (1); CREATE VIEW v1 AS SELECT 1; EXPLAIN SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived3> system NULL NULL NULL NULL 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived3> NULL system NULL NULL NULL NULL 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1); a a 1 1 @@ -1771,11 +1771,11 @@ insert into t3 values('three'),( 'four'); insert into t3 values('three'),( 'four'); insert into t3 values('three'),( 'four'); explain select * from t3 where t3.b in (select t2.b from t1 left join t2 on t1.a=t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 8 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 10 func 1 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 8 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 10 func 1 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) select * from t3 where t3.b in (select t2.b from t1 left join t2 on t1.a=t2.a); b drop table t1, t2, t3; @@ -1826,10 +1826,10 @@ set optimizer_switch='firstmatch=off,loosescan=off,materialization=off'; # Check DuplicateWeedout + join buffer explain select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; End temporary; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where; End temporary; Using join buffer (incremental, BNL join) select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a); a 1 @@ -1839,10 +1839,10 @@ set @tmp_jcl_20110622= @@join_cache_level; set join_cache_level= 0; explain select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where; End temporary select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a); a 1 @@ -1851,10 +1851,10 @@ a set optimizer_switch='firstmatch=on'; explain select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where; End temporary select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a); a 1 @@ -1870,11 +1870,11 @@ set join_cache_level= 0; explain select * from t0 where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary -1 PRIMARY t3 ALL NULL NULL NULL NULL 1 Using where -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where; End temporary select * from t0 where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a); a @@ -1885,11 +1885,11 @@ set @@join_cache_level=@tmp_jcl_20110622; explain select * from t0 where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where; End temporary; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using where; End temporary; Using join buffer (incremental, BNL join) select * from t0 where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a); a @@ -1903,11 +1903,11 @@ insert into t3 values(2,2); explain select * from t0 where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 2 -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using join buffer (incremental, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 Using join buffer (incremental, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where; End temporary; Using join buffer (incremental, BNL join) select * from t0 where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a); a @@ -2005,12 +2005,12 @@ CREATE VIEW v4 AS SELECT DISTINCT f2 FROM t4 ; # The following must not have outer joins: explain extended SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE t2.f3 IN (SELECT * FROM t4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (incremental, BNL join) -2 MATERIALIZED t4 index f2 f2 5 NULL 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (incremental, BNL join) +2 MATERIALIZED t4 NULL index f2 f2 5 NULL 2 100.00 Using index Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where `test`.`t3`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`f2` = `test`.`t2`.`f2` SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE t2.f3 IN (SELECT * FROM t4); @@ -2099,11 +2099,11 @@ INSERT INTO t4 VALUES (0),(NULL); # in the middle of the inner side of an outer join: explain SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE IFNULL(t2.f3,'foo') IN (SELECT * FROM t4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 5 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary; Using join buffer (incremental, BNL join) SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3 ) WHERE IFNULL(t2.f3,'foo') IN (SELECT * FROM t4); f1 f2 f3 f3 2 0 0 0 @@ -2163,10 +2163,10 @@ INSERT INTO t3 VALUES (6,5),(6,2),(8,0),(9,1),(6,5); # This used to incorrectly pick a join order of (t1, LooseScan(t3), t2): explain SELECT * FROM t1, t2 WHERE (t2.a , t1.b) IN (SELECT a, b FROM t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 2 Using index; Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL b NULL NULL NULL 5 Using where; Start temporary; End temporary; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 2 Using index; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL b NULL NULL NULL 5 Using where; Start temporary; End temporary; Using join buffer (incremental, BNL join) SELECT * FROM t1, t2 WHERE (t2.a , t1.b) IN (SELECT a, b FROM t3); b a 5 6 @@ -2188,11 +2188,11 @@ CREATE TABLE t5 ( b int, a int , KEY (a,b)) ; INSERT INTO t5 VALUES (7,0),(9,0); explain SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t5 index a a 10 NULL 2 Using index; Start temporary -1 PRIMARY t4 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) -1 PRIMARY t2 ALL b NULL NULL NULL 10 Using where; Using join buffer (incremental, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; End temporary; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t5 NULL index a a 10 NULL 2 Using index; Start temporary +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL ALL b NULL NULL NULL 10 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 15 Using where; End temporary; Using join buffer (incremental, BNL join) SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b); a 0 @@ -2270,13 +2270,13 @@ WHERE alias1.c IN (SELECT SQ3_alias1.b FROM t2 AS SQ3_alias1 STRAIGHT_JOIN t2 AS SQ3_alias2) LIMIT 100; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY SQ3_alias1 ALL NULL NULL NULL NULL 20 Start temporary -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) -1 PRIMARY SQ3_alias2 index NULL PRIMARY 4 NULL 20 Using index; End temporary; Using join buffer (incremental, BNL join) -1 PRIMARY alias2 ALL NULL NULL NULL NULL 20 Using join buffer (incremental, BNL join) -1 PRIMARY t2 ALL NULL NULL NULL NULL 20 Using join buffer (incremental, BNL join) -2 DERIVED t2 ALL NULL NULL NULL NULL 20 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY SQ3_alias1 NULL ALL NULL NULL NULL NULL 20 Start temporary +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY SQ3_alias2 NULL index NULL PRIMARY 4 NULL 20 Using index; End temporary; Using join buffer (incremental, BNL join) +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 20 Using join buffer (incremental, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 Using join buffer (incremental, BNL join) +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 20 create table t3 as SELECT alias1.a, alias1.b, alias1.c, alias1.d, alias1.e, alias1.f, @@ -2358,11 +2358,11 @@ CREATE TABLE t3 ( a int, d int) ; INSERT INTO t3 VALUES (19,1),(7,1),(3,1),(3,1),(20,1),(3,1),(16,1),(17,1),(9,1),(4,1),(6,1),(15,1),(17,1); explain SELECT * FROM t1 WHERE (a) IN (SELECT a FROM t2 JOIN t3 ON b = a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 9 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 13 Using where -2 MATERIALIZED t2 ref b b 4 test.t3.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 13 Using where +2 MATERIALIZED t2 NULL ref b b 4 test.t3.a 1 Using index SELECT * FROM t1 WHERE (a) IN (SELECT a FROM t2 JOIN t3 ON b = a); a 19 @@ -2413,9 +2413,9 @@ set optimizer_switch='firstmatch=off'; set optimizer_switch='semijoin_with_cache=on'; explain select * from t1 where t1.a in (select t2.a from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) select * from t1 where t1.a in (select t2.a from t2); a 1 @@ -2423,9 +2423,9 @@ a set optimizer_switch='semijoin_with_cache=off'; explain select * from t1 where t1.a in (select t2.a from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY t2 ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 6 Using where; Start temporary; End temporary select * from t1 where t1.a in (select t2.a from t2); a 1 @@ -2446,20 +2446,20 @@ SET SESSION optimizer_switch='semijoin=on,firstmatch=on'; SET SESSION optimizer_switch='loosescan=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index idx idx 9 NULL 2 Using where; Using index; Start temporary -1 PRIMARY t3 ref idx idx 4 test.t2.b 1 Using index -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index idx idx 9 NULL 2 Using where; Using index; Start temporary +1 PRIMARY t3 NULL ref idx idx 4 test.t2.b 1 Using index +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; End temporary; Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b); a 5 SET SESSION optimizer_switch='loosescan=on'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 index idx idx 9 NULL 2 Using where; Using index; Start temporary -1 PRIMARY t3 ref idx idx 4 test.t2.b 1 Using index -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL index idx idx 9 NULL 2 Using where; Using index; Start temporary +1 PRIMARY t3 NULL ref idx idx 4 test.t2.b 1 Using index +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using where; End temporary; Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b); a 5 @@ -2478,11 +2478,11 @@ set @tmp_otimizer_switch= @@optimizer_switch; SET SESSION optimizer_switch='semijoin=on,materialization=on'; EXPLAIN SELECT * FROM t1 RIGHT JOIN t2 ON b = a WHERE t2.b IN (SELECT c FROM t3); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 SELECT * FROM t1 RIGHT JOIN t2 ON b = a WHERE t2.b IN (SELECT c FROM t3); a b 4 4 @@ -2508,12 +2508,12 @@ SET optimizer_prune_level=0; EXPLAIN SELECT * FROM t1, t2 WHERE t1.a = t2.a AND t2.a IN (SELECT b FROM t3 STRAIGHT_JOIN t4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 system NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 1 -1 PRIMARY t2 ref a a 5 const 1 Using index -1 PRIMARY t1 ref a a 5 func 1 Using index -2 MATERIALIZED t4 ALL NULL NULL NULL NULL 0 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 1 +1 PRIMARY t2 NULL ref a a 5 const 1 Using index +1 PRIMARY t1 NULL ref a a 5 func 1 Using index +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 0 SELECT * FROM t1, t2 WHERE t1.a = t2.a AND t2.a IN (SELECT b FROM t3 STRAIGHT_JOIN t4); a a @@ -2584,11 +2584,11 @@ explain SELECT a, b, d FROM t1, t2 WHERE ( b, d ) IN ( SELECT b, d FROM t1, t2 WHERE b = c ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 -1 PRIMARY t1 index b b 5 NULL 10 Using where; Using index; LooseScan -1 PRIMARY t2 ref c c 5 test.t1.b 1 Using where; FirstMatch(t1) -1 PRIMARY t1 ref b b 5 test.t1.b 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 +1 PRIMARY t1 NULL index b b 5 NULL 10 Using where; Using index; LooseScan +1 PRIMARY t2 NULL ref c c 5 test.t1.b 1 Using where; FirstMatch(t1) +1 PRIMARY t1 NULL ref b b 5 test.t1.b 2 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT a, b, d FROM t1, t2 WHERE ( b, d ) IN ( SELECT b, d FROM t1, t2 WHERE b = c ); @@ -2647,11 +2647,11 @@ delete from t1 where kp2 in (1,3); explain select sum(t2.a) from t2,t3 where (t3.a,t2.a) in (select kp1,kp2 from t1,t0 where t0.a=2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 const PRIMARY PRIMARY 4 const 1 Using index -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY t1 ref kp1 kp1 5 test.t3.a 10 Using where; Using index; LooseScan -1 PRIMARY t2 ref a a 5 test.t1.kp2 19 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL const PRIMARY PRIMARY 4 const 1 Using index +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 10 Using where; Using index; LooseScan +1 PRIMARY t2 NULL ref a a 5 test.t1.kp2 19 Using index select sum(t2.a) from t2,t3 where (t3.a,t2.a) in (select kp1,kp2 from t1,t0 where t0.a=2); @@ -2721,9 +2721,9 @@ a 18 19 explain select * from t3 where a in (select kp1 from t1 where kp1<20); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 100 Using where -1 PRIMARY t1 ref kp1 kp1 5 test.t3.a 1 Using index; FirstMatch(t3) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 100 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 1 Using index; FirstMatch(t3) drop table t0,t1,t3; set optimizer_switch= @tmp_923246; # @@ -2777,11 +2777,11 @@ VIEW v1 AS SELECT * FROM t1; EXPLAIN SELECT * FROM t1 AS t1_1, t1 AS t1_2 WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_1 ALL NULL NULL NULL NULL 11 Using where -1 PRIMARY t1_2 ALL NULL NULL NULL NULL 11 -1 PRIMARY <derived3> ref key0 key0 5 test.t1_1.a 2 Using where; FirstMatch(t1_2) -3 DERIVED t1 ALL NULL NULL NULL NULL 11 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_1 NULL ALL NULL NULL NULL NULL 11 Using where +1 PRIMARY t1_2 NULL ALL NULL NULL NULL NULL 11 +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t1_1.a 2 Using where; FirstMatch(t1_2) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 SELECT * FROM t1 AS t1_1, t1 AS t1_2 WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 ); a b a b @@ -2937,10 +2937,10 @@ ON alias2.col_int_key = alias1.pk OR alias2.col_int_key = alias1.col_int_key WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o' ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 index_merge PRIMARY,col_int_key,col_varchar_key PRIMARY,col_varchar_key 4,4 NULL 2 Using sort_union(PRIMARY,col_varchar_key); Using where; Start temporary -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -1 PRIMARY alias2 ALL col_int_key NULL NULL NULL 12 Range checked for each record (index map: 0x2); End temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY alias1 NULL index_merge PRIMARY,col_int_key,col_varchar_key PRIMARY,col_varchar_key 4,4 NULL 2 Using sort_union(PRIMARY,col_varchar_key); Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 PRIMARY alias2 NULL ALL col_int_key NULL NULL NULL 12 Range checked for each record (index map: 0x2); End temporary SELECT * FROM t2 WHERE (field1) IN (SELECT alias1.col_varchar_nokey AS field1 @@ -3044,11 +3044,11 @@ pk c1 c2 # This should show that "t1 left join t3" is still in the semi-join nest: EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE pk IN ( SELECT pk FROM t1 LEFT JOIN t3 ON (c1 = c3 ) ) ORDER BY c2, c1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 Using temporary; Using filesort -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 5 100.00 Start temporary -1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where; End temporary; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 Using temporary; Using filesort +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 5 100.00 Start temporary +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; End temporary; Using join buffer (incremental, BNL join) Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1` AS `c1`,'x' AS `c2` from `test`.`t1` semi join (`test`.`t1` left join `test`.`t3` on(`test`.`t1`.`c1` = `test`.`t3`.`c3`)) where `test`.`t1`.`pk` = `test`.`t1`.`pk` order by 'x',`test`.`t1`.`c1` DROP TABLE t1,t2,t3; @@ -3099,11 +3099,11 @@ CREATE TABLE t4 (f4 INT); INSERT INTO t4 VALUES (0),(5); explain SELECT * FROM t1, t2, t3 WHERE f2 IN ( f1 IN ( SELECT f4 FROM t4 ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ref f2 f2 5 const 0 Using where; Using index -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL ref f2 f2 5 const 0 Using where; Using index +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t4 NULL ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1, t2, t3 WHERE f2 IN ( f1 IN ( SELECT f4 FROM t4 ) ); f1 f2 f3 1 0 1 @@ -3180,16 +3180,16 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain select a from t1, t2 where b between 1 and 2 and a in (select b from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 1462 Using index; FirstMatch(t1) -1 PRIMARY t2 range idx idx 5 NULL 5 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 1462 Using index; FirstMatch(t1) +1 PRIMARY t2 NULL range idx idx 5 NULL 5 Using where; Using index; Using join buffer (flat, BNL join) explain select a from t1 join t2 on b between 1 and 2 and a in (select b from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 1462 Using index; FirstMatch(t1) -1 PRIMARY t2 range idx idx 5 NULL 5 Using where; Using index; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 1462 Using index; FirstMatch(t1) +1 PRIMARY t2 NULL range idx idx 5 NULL 5 Using where; Using index; Using join buffer (flat, BNL join) drop table t1,t2; set optimizer_switch= @tmp_mdev12675; # @@ -3217,11 +3217,11 @@ FROM t1 LEFT JOIN ( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) ) ON (c1 = c3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) -2 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +2 SUBQUERY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t3`.`c3` = `test`.`t1`.`c1` and <cache>(<in_optimizer>(1,<exists>(/* select#2 */ select `test`.`t4`.`c4` from `test`.`t4` where 1 = `test`.`t4`.`c4`)))) where 1 # mdev-12820 @@ -3238,11 +3238,11 @@ FROM t1 LEFT JOIN ( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 ) ON (c1 = c2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join) -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join) +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(`test`.`t2`.`c2` = `test`.`t1`.`c1` and <in_optimizer>(`test`.`t1`.`c1`,<exists>(/* select#3 */ select `test`.`t3`.`c3` from `test`.`t3` where <cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))) where 1 DROP TABLE t1,t2,t3,t4; @@ -3298,10 +3298,10 @@ Id 1 explain extended SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t2 ref col1 col1 5 const 2 100.00 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t2 NULL ref col1 col1 5 const 2 100.00 Using index condition; Using where Warnings: Note 1003 select 1 AS `Id` from (`test`.`t2`) where `test`.`t2`.`t1_Id` = 1 and `test`.`t2`.`col1` is null DROP TABLE t1, t2; @@ -3324,10 +3324,10 @@ insert into t4 select floor(rand()*1000) from t2 limit 500; # # Instead, it should use eq_ref on the materialized table. explain select * from t3 where a in (select a from t4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 10000 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t4 ALL NULL NULL NULL NULL 500 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 10000 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 500 drop table t1, t2, t3, t4; # # MDEV-20770: Server crashes in JOIN::transform_in_predicates_into_in_subq @@ -3367,10 +3367,10 @@ The following should use a join order of t0,t1,t2, with DuplicateElimination: explain SELECT * FROM t0 WHERE t0.a IN (SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY t1 ref a a 5 test.t0.a 1 Start temporary; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using where; End temporary; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY t1 NULL ref a a 5 test.t0.a 1 Start temporary; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t0.a 1 Using where; End temporary; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT * FROM t0 WHERE t0.a IN (SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b); a @@ -3400,10 +3400,10 @@ SET SESSION join_cache_level=3; EXPLAIN SELECT * FROM t1, t2 WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 ALL PRIMARY NULL NULL NULL 4 Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL d NULL NULL NULL 5 Range checked for each record (index map: 0x2); FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL ALL PRIMARY NULL NULL NULL 4 Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL d NULL NULL NULL 5 Range checked for each record (index map: 0x2); FirstMatch(t2) SELECT * FROM t1, t2 WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a); a a b @@ -3415,10 +3415,10 @@ SET SESSION join_cache_level=6; EXPLAIN SELECT * FROM t1, t2 WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY t2 ALL PRIMARY NULL NULL NULL 4 Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL d NULL NULL NULL 5 Range checked for each record (index map: 0x2); FirstMatch(t2) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY t2 NULL ALL PRIMARY NULL NULL NULL 4 Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL d NULL NULL NULL 5 Range checked for each record (index map: 0x2); FirstMatch(t2) SELECT * FROM t1, t2 WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a); a a b @@ -3476,11 +3476,11 @@ set join_cache_level=0; EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON (c = b) WHERE (a, b) IN (SELECT a, b FROM t1 t); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL idx_a NULL NULL NULL 3 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -1 PRIMARY t2 ref idx_c idx_c 4 test.t1.b 2 Using where; Using index -2 MATERIALIZED t ALL idx_a NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL idx_a NULL NULL NULL 3 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +1 PRIMARY t2 NULL ref idx_c idx_c 4 test.t1.b 2 Using where; Using index +2 MATERIALIZED t NULL ALL idx_a NULL NULL NULL 3 SELECT * FROM t1 LEFT JOIN t2 ON (c = b) WHERE (a, b) IN (SELECT a, b FROM t1 t); a b c @@ -3491,11 +3491,11 @@ t t NULL EXPLAIN SELECT * FROM t1 LEFT JOIN t3 ON (c = b) WHERE (a, b) IN (SELECT a, b FROM t1 t); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL idx_a NULL NULL NULL 3 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -1 PRIMARY t3 ref idx_c idx_c 4 test.t1.b 2 Using where -2 MATERIALIZED t ALL idx_a NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL idx_a NULL NULL NULL 3 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +1 PRIMARY t3 NULL ref idx_c idx_c 4 test.t1.b 2 Using where +2 MATERIALIZED t NULL ALL idx_a NULL NULL NULL 3 SELECT * FROM t1 LEFT JOIN t3 ON (c = b) WHERE (a, b) IN (SELECT a, b FROM t1 t); a b c d @@ -3507,11 +3507,11 @@ set join_cache_level=6; EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON (c = b) WHERE (a, b) IN (SELECT a, b FROM t1 t); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL idx_a NULL NULL NULL 3 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -1 PRIMARY t2 ref idx_c idx_c 4 test.t1.b 2 Using where; Using index -2 MATERIALIZED t ALL idx_a NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL idx_a NULL NULL NULL 3 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +1 PRIMARY t2 NULL ref idx_c idx_c 4 test.t1.b 2 Using where; Using index +2 MATERIALIZED t NULL ALL idx_a NULL NULL NULL 3 SELECT * FROM t1 LEFT JOIN t2 ON (c = b) WHERE (a, b) IN (SELECT a, b FROM t1 t); a b c @@ -3522,11 +3522,11 @@ t t NULL EXPLAIN SELECT * FROM t1 LEFT JOIN t3 ON (c = b) WHERE (a, b) IN (SELECT a, b FROM t1 t); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL idx_a NULL NULL NULL 3 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -1 PRIMARY t3 ref idx_c idx_c 4 test.t1.b 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -2 MATERIALIZED t ALL idx_a NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL idx_a NULL NULL NULL 3 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +1 PRIMARY t3 NULL ref idx_c idx_c 4 test.t1.b 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +2 MATERIALIZED t NULL ALL idx_a NULL NULL NULL 3 SELECT * FROM t1 LEFT JOIN t3 ON (c = b) WHERE (a, b) IN (SELECT a, b FROM t1 t); a b c d @@ -3553,11 +3553,11 @@ set join_cache_level=0; EXPLAIN SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a) GROUP BY a HAVING a != 'z'; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t range idx_a idx_a 4 NULL 3 Using where; Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t1 ref idx_a idx_a 4 test.t2.b 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL range idx_a idx_a 4 NULL 3 Using where; Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t1 NULL ref idx_a idx_a 4 test.t2.b 2 Using index SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a) GROUP BY a HAVING a != 'z'; a @@ -3567,11 +3567,11 @@ set join_cache_level=6; EXPLAIN SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a) GROUP BY a HAVING a != 'z'; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t range idx_a idx_a 4 NULL 3 Using where; Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where -2 MATERIALIZED t1 ref idx_a idx_a 4 test.t2.b 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL range idx_a idx_a 4 NULL 3 Using where; Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t1 NULL ref idx_a idx_a 4 test.t2.b 2 Using index SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a) GROUP BY a HAVING a != 'z'; a diff --git a/mysql-test/main/subselect_sj_mat.result b/mysql-test/main/subselect_sj_mat.result index 97dcf07705c..ae3296e48e8 100644 --- a/mysql-test/main/subselect_sj_mat.result +++ b/mysql-test/main/subselect_sj_mat.result @@ -58,10 +58,10 @@ set @@optimizer_switch='materialization=on,in_to_exists=off,firstmatch=off'; # non-indexed nullable fields explain extended select * from t1 where a1 in (select b1 from t2 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b1` > '0' select * from t1 where a1 in (select b1 from t2 where b1 > '0'); @@ -70,10 +70,10 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b1` > '0' select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1); @@ -82,10 +82,10 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 func,func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 16 func,func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b1` > '0' select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2); @@ -94,10 +94,10 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (/* select#2 */ select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`b1` > '0' group by `test`.`t2`.`b1`) join `test`.`t1` where `<subquery2>`.`b1` = `test`.`t1`.`a1` and `<subquery2>`.`min(b2)` = `test`.`t1`.`a2` select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1); @@ -106,10 +106,10 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1i where a1 in (select b1 from t2i where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1i range _it1_idx _it1_idx # NULL 3 100.00 Using where; -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key # func 1 100.00 -2 MATERIALIZED t2i range it2i1,it2i3 it2i1 # NULL 5 100.00 Using where; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL range _it1_idx _it1_idx # NULL 3 100.00 Using where; +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key # func 1 100.00 +2 MATERIALIZED t2i NULL range it2i1,it2i3 it2i1 # NULL 5 100.00 Using where; Warnings: Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where `test`.`t2i`.`b1` > '0' select * from t1i where a1 in (select b1 from t2i where b1 > '0'); @@ -118,10 +118,10 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1i index it1i1,it1i3 # 18 # 3 100.00 # -1 PRIMARY <subquery2> eq_ref distinct_key # 8 # 1 100.00 # -2 MATERIALIZED t2i range it2i1,it2i3 # 9 # 5 100.00 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL index it1i1,it1i3 # 18 # 3 100.00 # +1 PRIMARY <subquery2> NULL eq_ref distinct_key # 8 # 1 100.00 # +2 MATERIALIZED t2i NULL range it2i1,it2i3 # 9 # 5 100.00 # Warnings: Note 1003 /* select#1 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (/* select#2 */ select max(`test`.`t2i`.`b1`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1i` where `<subquery2>`.`max(b1)` = `test`.`t1i`.`a1` select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1); @@ -130,10 +130,10 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1i range _it1_idx _it1_idx # NULL 3 100.00 Using where; -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key # func,func 1 100.00 -2 MATERIALIZED t2i range it2i1,it2i2,it2i3 it2i3 # NULL 5 100.00 Using where; +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL range _it1_idx _it1_idx # NULL 3 100.00 Using where; +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key # func,func 1 100.00 +2 MATERIALIZED t2i NULL range it2i1,it2i2,it2i3 it2i3 # NULL 5 100.00 Using where; Warnings: Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where `test`.`t2i`.`b1` > '0' select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0'); @@ -142,10 +142,10 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1i index it1i1,it1i2,it1i3 # # # 3 100.00 # -1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 # -2 MATERIALIZED t2i range it2i1,it2i3 # # # 5 100.00 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL index it1i1,it1i2,it1i3 # # # 3 100.00 # +1 PRIMARY <subquery2> NULL eq_ref distinct_key # # # 1 100.00 # +2 MATERIALIZED t2i NULL range it2i1,it2i3 # # # 5 100.00 # Warnings: Note 1003 /* select#1 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1i` where `<subquery2>`.`b1` = `test`.`t1i`.`a1` and `<subquery2>`.`max(b2)` = `test`.`t1i`.`a2` select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1); @@ -154,10 +154,10 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1i index it1i1,it1i2,it1i3 # # # 3 100.00 # -1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 # -2 MATERIALIZED t2i range it2i1,it2i3 # # # 5 100.00 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL index it1i1,it1i2,it1i3 # # # 3 100.00 # +1 PRIMARY <subquery2> NULL eq_ref distinct_key # # # 1 100.00 # +2 MATERIALIZED t2i NULL range it2i1,it2i3 # # # 5 100.00 # Warnings: Note 1003 /* select#1 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1i` where `<subquery2>`.`b1` = `test`.`t1i`.`a1` and `<subquery2>`.`min(b2)` = `test`.`t1i`.`a2` select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); @@ -184,10 +184,10 @@ t2i_c CREATE TABLE `t2i_c` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 explain extended select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 -2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 4 100.00 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 +2 MATERIALIZED t2i_c NULL range NULL it2i3 9 NULL 4 100.00 Using index for group-by Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (/* select#2 */ select `test`.`t2i_c`.`b1`,max(`test`.`t2i_c`.`b2`) from `test`.`t2i_c` group by `test`.`t2i_c`.`b1`) join `test`.`t1` where `<subquery2>`.`b1` = `test`.`t1`.`a1` and `<subquery2>`.`max(b2)` = `test`.`t1`.`a2` select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1); @@ -196,15 +196,15 @@ a1 a2 1 - 02 2 - 02 prepare st1 from "explain select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1)"; execute st1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 -2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 4 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 +2 MATERIALIZED t2i_c NULL range NULL it2i3 9 NULL 4 Using index for group-by execute st1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 -2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 4 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 +2 MATERIALIZED t2i_c NULL range NULL it2i3 9 NULL 4 Using index for group-by prepare st2 from "select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1)"; execute st2; a1 a2 @@ -217,10 +217,10 @@ a1 a2 drop table t2i_c; explain extended select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 -2 MATERIALIZED t2i range it2i1,it2i3 it2i3 9 NULL 5 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 +2 MATERIALIZED t2i NULL range it2i1,it2i3 it2i3 9 NULL 5 100.00 Using where; Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1` where `<subquery2>`.`b1` = `test`.`t1`.`a1` and `<subquery2>`.`min(b2)` = `test`.`t1`.`a2` select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); @@ -265,10 +265,10 @@ a1 a2 set @@optimizer_switch=@local_optimizer_switch; explain extended select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 func,func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 16 func,func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) where 1 select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2); @@ -277,9 +277,9 @@ a1 a2 1 - 02 2 - 02 explain extended select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 50.00 Using where; Using index; LooseScan -1 PRIMARY t1i ref it1i1,it1i2,it1i3 it1i3 18 test.t2i.b1,test.t2i.b2 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2i NULL index it2i1,it2i2,it2i3 it2i3 18 NULL 5 50.00 Using where; Using index; LooseScan +1 PRIMARY t1i NULL ref it1i1,it1i2,it1i3 it1i3 18 test.t2i.b1,test.t2i.b2 1 100.00 Using index Warnings: Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where `test`.`t1i`.`a1` = `test`.`t2i`.`b1` and `test`.`t1i`.`a2` = `test`.`t2i`.`b2` select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2); @@ -330,13 +330,13 @@ select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and (a1, a2) in (select c1, c2 from t3 where (c1, c2) in (select b1, b2 from t2i where b2 > '0')); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 16 func,func 1 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 func,func 1 100.00 -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -3 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 16 func,func 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 16 func,func 1 100.00 +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +3 MATERIALIZED t2i NULL ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and `test`.`t2`.`b1` > '0' and `test`.`t3`.`c2` > '0' select * from t1 @@ -351,13 +351,13 @@ select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and (a1, a2) in (select c1, c2 from t3i where (c1, c2) in (select b1, b2 from t2i where b2 > '0')); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1i range it1i1,it1i2,it1i3 # # # 3 100.00 # -1 PRIMARY <subquery3> eq_ref distinct_key # # # 1 100.00 # -1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 # -3 MATERIALIZED t3i range it3i1,it3i2,it3i3 # # # 4 100.00 # -3 MATERIALIZED t2i ref it2i1,it2i2,it2i3 # # # 1 100.00 # -2 MATERIALIZED t2i range it2i1,it2i2,it2i3 # # # 5 100.00 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL range it1i1,it1i2,it1i3 # # # 3 100.00 # +1 PRIMARY <subquery3> NULL eq_ref distinct_key # # # 1 100.00 # +1 PRIMARY <subquery2> NULL eq_ref distinct_key # # # 1 100.00 # +3 MATERIALIZED t3i NULL range it3i1,it3i2,it3i3 # # # 4 100.00 # +3 MATERIALIZED t2i NULL ref it2i1,it2i2,it2i3 # # # 1 100.00 # +2 MATERIALIZED t2i NULL range it2i1,it2i2,it2i3 # # # 5 100.00 # Warnings: Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where `test`.`t2i`.`b1` = `test`.`t3i`.`c1` and `test`.`t2i`.`b2` = `test`.`t3i`.`c2` and `test`.`t2i`.`b1` > '0' and `test`.`t3i`.`c2` > '0' select * from t1i @@ -374,15 +374,15 @@ where b2 in (select c2 from t3 where c2 LIKE '%02') or b2 in (select c2 from t3 where c2 LIKE '%03')) and (a1, a2) in (select c1, c2 from t3 where (c1, c2) in (select b1, b2 from t2i where b2 > '0')); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery5> eq_ref distinct_key distinct_key 16 func,func 1 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 func,func 1 100.00 -5 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where -4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery5> NULL eq_ref distinct_key distinct_key 16 func,func 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 16 func,func 1 100.00 +5 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +5 MATERIALIZED t2i NULL ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +4 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (/* select#3 */ select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%02' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery3>`.`c2`)))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (/* select#4 */ select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`))))) and `test`.`t3`.`c2` > '0' select * from t1 @@ -400,14 +400,14 @@ where b2 in (select c2 from t3 t3a where c1 = a1) or b2 in (select c2 from t3 t3b where c2 LIKE '%03')) and (a1, a2) in (select c1, c2 from t3 t3c where (c1, c2) in (select b1, b2 from t2i where b2 > '0')); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery5> eq_ref distinct_key distinct_key 16 func,func 1 100.00 -1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) -5 MATERIALIZED t3c ALL NULL NULL NULL NULL 4 100.00 Using where -5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3c.c1,test.t3c.c2 1 100.00 Using index -4 MATERIALIZED t3b ALL NULL NULL NULL NULL 4 100.00 Using where -3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery5> NULL eq_ref distinct_key distinct_key 16 func,func 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +5 MATERIALIZED t3c NULL ALL NULL NULL NULL NULL 4 100.00 Using where +5 MATERIALIZED t2i NULL ref it2i1,it2i2,it2i3 it2i3 18 test.t3c.c1,test.t3c.c2 1 100.00 Using index +4 MATERIALIZED t3b NULL ALL NULL NULL NULL NULL 4 100.00 Using where +3 DEPENDENT SUBQUERY t3a NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where `test`.`t2i`.`b1` = `test`.`t3c`.`c1` and `test`.`t2`.`b1` = `test`.`t1`.`a1` and `test`.`t2i`.`b2` = `test`.`t3c`.`c2` and `test`.`t2`.`b2` = `test`.`t1`.`a2` and (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(/* select#3 */ select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where `test`.`t3a`.`c1` = `test`.`t1`.`a1` and <cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (/* select#4 */ select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where `test`.`t3b`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`))))) and `test`.`t3c`.`c2` > '0' @@ -433,22 +433,22 @@ UNION where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and (a1, a2) in (select c1, c2 from t3i where (c1, c2) in (select b1, b2 from t2i where b2 > '0'))); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL # # # 3 100.00 # -1 PRIMARY <subquery5> eq_ref distinct_key # # # 1 100.00 # -1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 # -5 MATERIALIZED t3 ALL NULL # # # 4 100.00 # -5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 # # # 1 100.00 # -2 MATERIALIZED t2 ALL NULL # # # 5 100.00 # -4 MATERIALIZED t3 ALL NULL # # # 4 100.00 # -3 MATERIALIZED t3 ALL NULL # # # 4 100.00 # -7 UNION t1i range it1i1,it1i2,it1i3 # # # 3 100.00 # -7 UNION <subquery9> eq_ref distinct_key # # # 1 100.00 # -7 UNION <subquery8> eq_ref distinct_key # # # 1 100.00 # -9 MATERIALIZED t3i range it3i1,it3i2,it3i3 # # # 4 100.00 # -9 MATERIALIZED t2i ref it2i1,it2i2,it2i3 # # # 1 100.00 # -8 MATERIALIZED t2i range it2i1,it2i2,it2i3 # # # 5 100.00 # -NULL UNION RESULT <union1,7> ALL NULL # # # NULL NULL # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL # # # 3 100.00 # +1 PRIMARY <subquery5> NULL eq_ref distinct_key # # # 1 100.00 # +1 PRIMARY <subquery2> NULL eq_ref distinct_key # # # 1 100.00 # +5 MATERIALIZED t3 NULL ALL NULL # # # 4 100.00 # +5 MATERIALIZED t2i NULL ref it2i1,it2i2,it2i3 # # # 1 100.00 # +2 MATERIALIZED t2 NULL ALL NULL # # # 5 100.00 # +4 MATERIALIZED t3 NULL ALL NULL # # # 4 100.00 # +3 MATERIALIZED t3 NULL ALL NULL # # # 4 100.00 # +7 UNION t1i NULL range it1i1,it1i2,it1i3 # # # 3 100.00 # +7 UNION <subquery9> NULL eq_ref distinct_key # # # 1 100.00 # +7 UNION <subquery8> NULL eq_ref distinct_key # # # 1 100.00 # +9 MATERIALIZED t3i NULL range it3i1,it3i2,it3i3 # # # 4 100.00 # +9 MATERIALIZED t2i NULL ref it2i1,it2i2,it2i3 # # # 1 100.00 # +8 MATERIALIZED t2i NULL range it2i1,it2i2,it2i3 # # # 5 100.00 # +NULL UNION RESULT <union1,7> NULL ALL NULL # # # NULL NULL # Warnings: Note 1003 (/* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (/* select#3 */ select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%02' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery3>`.`c2`)))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (/* select#4 */ select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`))))) and `test`.`t3`.`c2` > '0') union (/* select#7 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` A S `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where `test`.`t2i`.`b1` = `test`.`t3i`.`c1` and `test`.`t2i`.`b2` = `test`.`t3i`.`c2` and `test`.`t2i`.`b1` > '0' and `test`.`t3i`.`c2` > '0') (select * from t1 @@ -471,14 +471,14 @@ select * from t1 where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and (a1, a2) in (select c1, c2 from t3 where (c1, c2) in (select b1, b2 from t2i where b2 > '0')); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 16 func,func 1 100.00 -4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -4 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <subquery4> NULL eq_ref distinct_key distinct_key 16 func,func 1 100.00 +4 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +4 MATERIALIZED t2i NULL ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +3 DEPENDENT UNION t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(/* select#2 */ select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and <cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1` and <cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2` union /* select#3 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1` and <cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and `test`.`t3`.`c2` > '0' select * from t1 @@ -494,15 +494,15 @@ where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where (c1, c2) in (select c1, c2 from t3 where (c1, c2) in (select b1, b2 from t2i where b2 > '0')) and a1 = c1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 16 func,func 1 100.00 -4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -4 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <subquery4> NULL eq_ref distinct_key distinct_key 16 func,func 1 100.00 +4 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +4 MATERIALIZED t2i NULL ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +3 DEPENDENT UNION t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t3` where `test`.`t3`.`c1` = `test`.`t1`.`a1` and `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(/* select#2 */ select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and <cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1` and <cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2` union /* select#3 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1` and <cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and `test`.`t3`.`c2` > '0' select * from t1, t3 @@ -520,11 +520,11 @@ a1 a2 c1 c2 explain extended select * from t3 where c1 in (select a1 from t1 where a1 > '0' UNION select b1 from t2 where b1 < '9'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +3 DEPENDENT UNION t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t3` where <expr_cache><`test`.`t3`.`c1`>(<in_optimizer>(`test`.`t3`.`c1`,<exists>(/* select#2 */ select `test`.`t1`.`a1` from `test`.`t1` where `test`.`t1`.`a1` > '0' and <cache>(`test`.`t3`.`c1`) = `test`.`t1`.`a1` union /* select#3 */ select `test`.`t2`.`b1` from `test`.`t2` where `test`.`t2`.`b1` < '9' and <cache>(`test`.`t3`.`c1`) = `test`.`t2`.`b1`))) select * from t3 @@ -540,22 +540,22 @@ where b2 in (select c2 from t3 t3a where c1 = a1) or b2 in (select c2 from t3 t3b where c2 LIKE '%03')) and (a1, a2) in (select c1, c2 from t3 t3c where (c1, c2) in (select b1, b2 from t2i where b2 > '0' or b2 = a2)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t1.a1,test.t1.a2 1 100.00 Using index; Start temporary -1 PRIMARY t3c ALL NULL NULL NULL NULL 4 100.00 Using where; End temporary; Using join buffer (flat, BNL join) -1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) -4 MATERIALIZED t3b ALL NULL NULL NULL NULL 4 100.00 Using where -3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t2i NULL ref it2i1,it2i2,it2i3 it2i3 18 test.t1.a1,test.t1.a2 1 100.00 Using index; Start temporary +1 PRIMARY t3c NULL ALL NULL NULL NULL NULL 4 100.00 Using where; End temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +4 MATERIALIZED t3b NULL ALL NULL NULL NULL NULL 4 100.00 Using where +3 DEPENDENT SUBQUERY t3a NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a2' of SELECT #6 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where `test`.`t2i`.`b1` = `test`.`t1`.`a1` and `test`.`t3c`.`c1` = `test`.`t1`.`a1` and `test`.`t2`.`b1` = `test`.`t1`.`a1` and `test`.`t2i`.`b2` = `test`.`t1`.`a2` and `test`.`t3c`.`c2` = `test`.`t1`.`a2` and `test`.`t2`.`b2` = `test`.`t1`.`a2` and (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(/* select#3 */ select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where `test`.`t3a`.`c1` = `test`.`t1`.`a1` and <cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (/* select#4 */ select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where `test`.`t3b`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`))) )) explain extended select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(/* select#2 */ select '1 - 01','2 - 01' having (<cache>(`test`.`t1`.`a1`) = '1 - 01' or /*always not null*/ 1 is null) and (<cache>(`test`.`t1`.`a2`) = '2 - 01' or /*always not null*/ 1 is null) and '1 - 01' is null and '2 - 01' is null))) select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01'); @@ -563,9 +563,9 @@ a1 a2 1 - 01 2 - 01 explain extended select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(/* select#2 */ select '1 - 01','2 - 01' having (<cache>(`test`.`t1`.`a1`) = '1 - 01' or /*always not null*/ 1 is null) and (<cache>(`test`.`t1`.`a2`) = '2 - 01' or /*always not null*/ 1 is null) and '1 - 01' is null and '2 - 01' is null))) select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual); @@ -585,9 +585,9 @@ create table columns (col int key); insert into columns values (1), (2); explain extended select * from t1 group by (select col from columns limit 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -2 SUBQUERY columns index NULL PRIMARY 4 NULL 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 SUBQUERY columns NULL index NULL PRIMARY 4 NULL 2 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by (/* select#2 */ select `test`.`columns`.`col` from `test`.`columns` limit 1) select * from t1 group by (select col from columns limit 1); @@ -595,9 +595,9 @@ a1 a2 1 - 00 2 - 00 explain extended select * from t1 group by (a1 in (select col from columns)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using temporary; Using filesort -2 DEPENDENT SUBQUERY columns unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where; Full scan on NULL key +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using temporary; Using filesort +2 DEPENDENT SUBQUERY columns NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`a1`) in columns on PRIMARY where trigcond(<cache>(`test`.`t1`.`a1`) = `test`.`columns`.`col`))))) select * from t1 group by (a1 in (select col from columns)); @@ -610,9 +610,9 @@ Warning 1292 Truncated incorrect DOUBLE value: '1 - 02' /* ORDER BY clause */ explain extended select * from t1 order by (select col from columns limit 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -2 SUBQUERY columns index NULL PRIMARY 4 NULL 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 SUBQUERY columns NULL index NULL PRIMARY 4 NULL 2 100.00 Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` order by (/* select#2 */ select `test`.`columns`.`col` from `test`.`columns` limit 1) select * from t1 order by (select col from columns limit 1); @@ -656,9 +656,9 @@ insert into t3_16 values explain extended select left(a1,7), left(a2,7) from t1_16 where a1 in (select b1 from t2_16 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t2_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where `test`.`t2_16`.`b1` = `test`.`t1_16`.`a1` and `test`.`t1_16`.`a1` > '0' select left(a1,7), left(a2,7) @@ -670,9 +670,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_16 where (a1,a2) in (select b1, b2 from t2_16 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t2_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where `test`.`t2_16`.`b1` = `test`.`t1_16`.`a1` and `test`.`t2_16`.`b2` = `test`.`t1_16`.`a2` and `test`.`t1_16`.`a1` > '0' select left(a1,7), left(a2,7) @@ -684,10 +684,10 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_16 where a1 in (select substring(b1,1,16) from t2_16 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 19 func 1 100.00 Using where -2 MATERIALIZED t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_16 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 19 func 1 100.00 Using where +2 MATERIALIZED t2_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where `test`.`t2_16`.`b1` > '0' and `test`.`t1_16`.`a1` = substr(`test`.`t2_16`.`b1`,1,16) select left(a1,7), left(a2,7) @@ -699,9 +699,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_16 where a1 in (select group_concat(b1) from t2_16 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t2_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` where <expr_cache><`test`.`t1_16`.`a1`>(<in_optimizer>(`test`.`t1_16`.`a1`,<exists>(/* select#2 */ select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2` having <cache>(`test`.`t1_16`.`a1`) = <ref_null_helper>(group_concat(`test`.`t2_16`.`b1` separator ','))))) select left(a1,7), left(a2,7) @@ -714,10 +714,10 @@ set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_16 where a1 in (select group_concat(b1) from t2_16 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 260 test.t1_16.a1 1 100.00 Using where -2 MATERIALIZED t2_16 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 260 test.t1_16.a1 1 100.00 Using where +2 MATERIALIZED t2_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from <materialize> (/* select#2 */ select group_concat(`test`.`t2_16`.`b1` separator ',') from `test`.`t2_16` group by `test`.`t2_16`.`b2`) join `test`.`t1_16` where `test`.`t1_16`.`a1` = `<subquery2>`.`group_concat(b1)` select left(a1,7), left(a2,7) @@ -734,12 +734,12 @@ where (a1, a2) IN (select t2_16.b1, t2_16.b2 from t2_16, t2 where t2.b2 = substring(t2_16.b2,1,6) and t2.b1 IN (select c1 from t3 where c2 > '0'))); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) -1 PRIMARY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY t1_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2_16 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; End temporary; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t2_16` join `test`.`t2` join `test`.`t1_16`) where `test`.`t2`.`b1` = `test`.`t3`.`c1` and `test`.`t2_16`.`b1` = `test`.`t1_16`.`a1` and `test`.`t2_16`.`b2` = `test`.`t1_16`.`a2` and `test`.`t2`.`b2` = substr(`test`.`t1_16`.`a2`,1,6) and `test`.`t3`.`c2` > '0' and concat(`test`.`t1`.`a1`,'x') = left(`test`.`t1_16`.`a1`,8) drop table t1_16, t2_16, t3_16; @@ -771,9 +771,9 @@ insert into t3_512 values explain extended select left(a1,7), left(a2,7) from t1_512 where a1 in (select b1 from t2_512 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t2_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where `test`.`t2_512`.`b1` = `test`.`t1_512`.`a1` and `test`.`t1_512`.`a1` > '0' select left(a1,7), left(a2,7) @@ -785,9 +785,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_512 where (a1,a2) in (select b1, b2 from t2_512 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t2_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where `test`.`t2_512`.`b1` = `test`.`t1_512`.`a1` and `test`.`t2_512`.`b2` = `test`.`t1_512`.`a2` and `test`.`t1_512`.`a1` > '0' select left(a1,7), left(a2,7) @@ -799,10 +799,10 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_512 where a1 in (select substring(b1,1,512) from t2_512 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 516 func 1 100.00 Using where -2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_512 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 516 func 1 100.00 Using where +2 MATERIALIZED t2_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where `test`.`t2_512`.`b1` > '0' and `test`.`t1_512`.`a1` = substr(`test`.`t2_512`.`b1`,1,512) select left(a1,7), left(a2,7) @@ -814,10 +814,10 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 260 test.t1_512.a1 1 100.00 Using where -2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 260 test.t1_512.a1 1 100.00 Using where +2 MATERIALIZED t2_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from <materialize> (/* select#2 */ select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2`) join `test`.`t1_512` where `test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)` select left(a1,7), left(a2,7) @@ -832,10 +832,10 @@ set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 260 test.t1_512.a1 1 100.00 Using where -2 MATERIALIZED t2_512 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 260 test.t1_512.a1 1 100.00 Using where +2 MATERIALIZED t2_512 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from <materialize> (/* select#2 */ select group_concat(`test`.`t2_512`.`b1` separator ',') from `test`.`t2_512` group by `test`.`t2_512`.`b2`) join `test`.`t1_512` where `test`.`t1_512`.`a1` = `<subquery2>`.`group_concat(b1)` select left(a1,7), left(a2,7) @@ -875,9 +875,9 @@ insert into t3_1024 values explain extended select left(a1,7), left(a2,7) from t1_1024 where a1 in (select b1 from t2_1024 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t2_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where `test`.`t2_1024`.`b1` = `test`.`t1_1024`.`a1` and `test`.`t1_1024`.`a1` > '0' select left(a1,7), left(a2,7) @@ -889,9 +889,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_1024 where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t2_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where `test`.`t2_1024`.`b1` = `test`.`t1_1024`.`a1` and `test`.`t2_1024`.`b2` = `test`.`t1_1024`.`a2` and `test`.`t1_1024`.`a1` > '0' select left(a1,7), left(a2,7) @@ -903,9 +903,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_1024 where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1024 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY t2_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where `test`.`t2_1024`.`b1` > '0' and `test`.`t1_1024`.`a1` = substr(`test`.`t2_1024`.`b1`,1,1024) select left(a1,7), left(a2,7) @@ -917,10 +917,10 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 260 test.t1_1024.a1 1 100.00 Using where -2 MATERIALIZED t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 260 test.t1_1024.a1 1 100.00 Using where +2 MATERIALIZED t2_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from <materialize> (/* select#2 */ select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2`) join `test`.`t1_1024` where `test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)` select left(a1,7), left(a2,7) @@ -935,10 +935,10 @@ set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 260 test.t1_1024.a1 1 100.00 Using where -2 MATERIALIZED t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 260 test.t1_1024.a1 1 100.00 Using where +2 MATERIALIZED t2_1024 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from <materialize> (/* select#2 */ select group_concat(`test`.`t2_1024`.`b1` separator ',') from `test`.`t2_1024` group by `test`.`t2_1024`.`b2`) join `test`.`t1_1024` where `test`.`t1_1024`.`a1` = `<subquery2>`.`group_concat(b1)` select left(a1,7), left(a2,7) @@ -978,9 +978,9 @@ insert into t3_1025 values explain extended select left(a1,7), left(a2,7) from t1_1025 where a1 in (select b1 from t2_1025 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t2_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where `test`.`t2_1025`.`b1` = `test`.`t1_1025`.`a1` and `test`.`t1_1025`.`a1` > '0' select left(a1,7), left(a2,7) @@ -992,9 +992,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_1025 where (a1,a2) in (select b1, b2 from t2_1025 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY t2_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where `test`.`t2_1025`.`b1` = `test`.`t1_1025`.`a1` and `test`.`t2_1025`.`b2` = `test`.`t1_1025`.`a2` and `test`.`t1_1025`.`a1` > '0' select left(a1,7), left(a2,7) @@ -1006,9 +1006,9 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_1025 where a1 in (select substring(b1,1,1025) from t2_1025 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1025 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY t2_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where `test`.`t2_1025`.`b1` > '0' and `test`.`t1_1025`.`a1` = substr(`test`.`t2_1025`.`b1`,1,1025) select left(a1,7), left(a2,7) @@ -1020,10 +1020,10 @@ left(a1,7) left(a2,7) explain extended select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 260 test.t1_1025.a1 1 100.00 Using where -2 MATERIALIZED t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 260 test.t1_1025.a1 1 100.00 Using where +2 MATERIALIZED t2_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from <materialize> (/* select#2 */ select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2`) join `test`.`t1_1025` where `test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)` select left(a1,7), left(a2,7) @@ -1038,10 +1038,10 @@ set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 260 test.t1_1025.a1 1 100.00 Using where -2 MATERIALIZED t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 260 test.t1_1025.a1 1 100.00 Using where +2 MATERIALIZED t2_1025 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort Warnings: Note 1003 /* select#1 */ select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from <materialize> (/* select#2 */ select group_concat(`test`.`t2_1025`.`b1` separator ',') from `test`.`t2_1025` group by `test`.`t2_1025`.`b2`) join `test`.`t1_1025` where `test`.`t1_1025`.`a1` = `<subquery2>`.`group_concat(b1)` select left(a1,7), left(a2,7) @@ -1064,10 +1064,10 @@ insert into t2bit values (b'110', b'111'); explain extended select bin(a1), bin(a2) from t1bit where (a1, a2) in (select b1, b2 from t2bit); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1bit ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00 -2 MATERIALIZED t2bit ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1bit NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED t2bit NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select conv(`test`.`t1bit`.`a1`,10,2) AS `bin(a1)`,conv(`test`.`t1bit`.`a2`,10,2) AS `bin(a2)` from `test`.`t1bit` semi join (`test`.`t2bit`) where 1 select bin(a1), bin(a2) @@ -1088,9 +1088,9 @@ insert into t2bb values (b'110', '111'); explain extended select bin(a1), a2 from t1bb where (a1, a2) in (select b1, b2 from t2bb); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1bb ALL NULL NULL NULL NULL 3 100.00 -1 PRIMARY t2bb ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1bb NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY t2bb NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) Warnings: Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` semi join (`test`.`t2bb`) where `test`.`t2bb`.`b1` = `test`.`t1bb`.`a1` and `test`.`t2bb`.`b2` = `test`.`t1bb`.`a2` select bin(a1), a2 @@ -1136,10 +1136,10 @@ insert into t3 values (20); insert into t3 values (30); explain extended select a from t1 where a in (select c from t2 where d >= 20); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 7 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 7 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`d` >= 20 select a from t1 where a in (select c from t2 where d >= 20); @@ -1151,10 +1151,10 @@ a create index it1a on t1(a); explain extended select a from t1 where a in (select c from t2 where d >= 20); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index it1a it1a 4 NULL 7 100.00 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index it1a it1a 4 NULL 7 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`d` >= 20 select a from t1 where a in (select c from t2 where d >= 20); @@ -1166,10 +1166,10 @@ a insert into t2 values (1,10); explain extended select a from t1 where a in (select c from t2 where d >= 20); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 index it1a it1a 4 NULL 7 100.00 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index it1a it1a 4 NULL 7 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`d` >= 20 select a from t1 where a in (select c from t2 where d >= 20); @@ -1180,9 +1180,9 @@ a 3 explain extended select a from t1 group by a having a in (select c from t2 where d >= 20); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 range NULL it1a 4 NULL 8 100.00 Using index for group-by -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range NULL it1a 4 NULL 8 100.00 Using index for group-by +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`c`)))) select a from t1 group by a having a in (select c from t2 where d >= 20); @@ -1192,9 +1192,9 @@ a create index iab on t1(a, b); explain extended select a from t1 group by a having a in (select c from t2 where d >= 20); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 range NULL it1a 4 NULL 8 100.00 Using index for group-by -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 7 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range NULL it1a 4 NULL 8 100.00 Using index for group-by +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `test`.`t2`.`c` from `test`.`t2` where `test`.`t2`.`d` >= 20 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`c`)))) select a from t1 group by a having a in (select c from t2 where d >= 20); @@ -1204,10 +1204,10 @@ a explain extended select a from t1 group by a having a in (select c from t2 where d >= some(select e from t3 where max(b)=e)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 range NULL iab 4 NULL 8 100.00 Using index for group-by -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00 Using where -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range NULL iab 4 NULL 8 100.00 Using index for group-by +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 Note 1981 Aggregate function 'max()' of SELECT #3 belongs to SELECT #1 @@ -1220,10 +1220,10 @@ a explain extended select a from t1 where a in (select c from t2 where d >= some(select e from t3 where b=e)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 7 100.00 Start temporary -1 PRIMARY t1 ref it1a,iab iab 4 test.t2.c 1 100.00 Using where; Using index; End temporary -3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 7 100.00 Start temporary +1 PRIMARY t1 NULL ref it1a,iab iab 4 test.t2.c 1 100.00 Using where; Using index; End temporary +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t1`.`a` = `test`.`t2`.`c` and <nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`>(<in_optimizer>(`test`.`t2`.`d`,<exists>(/* select#3 */ select `test`.`t3`.`e` from `test`.`t3` where `test`.`t1`.`b` = `test`.`t3`.`e` and <cache>(`test`.`t2`.`d`) >= `test`.`t3`.`e`)))) @@ -1251,10 +1251,10 @@ create table t1 (a1 int key); create table t2 (b1 int); insert into t1 values (5); explain select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY <subquery2> NULL const distinct_key distinct_key 4 const 1 +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1); min(a1) NULL @@ -1262,18 +1262,18 @@ set @local_optimizer_switch=@@optimizer_switch; set @@optimizer_switch=@optimizer_switch_local_default; set @@optimizer_switch='materialization=off,in_to_exists=on'; explain select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1); min(a1) NULL set @@optimizer_switch=@optimizer_switch_local_default; set @@optimizer_switch='semijoin=off'; explain select min(a1) from t1 where 7 in (select b1 from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table select min(a1) from t1 where 7 in (select b1 from t2); min(a1) NULL @@ -1281,16 +1281,16 @@ set @@optimizer_switch=@optimizer_switch_local_default; set @@optimizer_switch='materialization=off,in_to_exists=on'; # with MariaDB and MWL#90, this particular case is solved: explain select min(a1) from t1 where 7 in (select b1 from t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables select min(a1) from t1 where 7 in (select b1 from t2); min(a1) NULL # but when we go around MWL#90 code, the problem still shows up: explain select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4; min(a1) NULL @@ -1300,10 +1300,10 @@ create table t1 (a char(2), b varchar(10)); insert into t1 values ('a', 'aaa'); insert into t1 values ('aa', 'aaaa'); explain select a,b from t1 where b in (select a from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 2 func 1 Using where -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 2 func 1 Using where +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 select a,b from t1 where b in (select a from t1); a b prepare st1 from "select a,b from t1 where b in (select a from t1)"; @@ -1337,12 +1337,12 @@ FROM t3 GROUP BY t3i ) ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 const 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 const 1 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 Using temporary DROP TABLE t1,t2,t3,t4; CREATE TABLE t1 ( pk INTEGER AUTO_INCREMENT, @@ -1446,10 +1446,10 @@ set optimizer_switch='derived_merge=off,derived_with_keys=off'; explain SELECT a FROM ( SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a > 3 OR t2.b IN (SELECT a FROM t1) ) table1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table -3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT a FROM ( SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a > 3 OR t2.b IN (SELECT a FROM t1) ) table1; @@ -1475,8 +1475,8 @@ INSERT INTO t1 VALUES (10,0); INSERT INTO t2 VALUES (10,0),(11,0); explain SELECT * FROM t1 JOIN t2 USING (f1) WHERE t1.f1 IN (SELECT t1.pk FROM t1 ORDER BY t1.f1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT * FROM t1 JOIN t2 USING (f1) WHERE t1.f1 IN (SELECT t1.pk FROM t1 ORDER BY t1.f1); f1 pk pk @@ -1547,10 +1547,10 @@ set @local_optimizer_switch=@@optimizer_switch; set @@optimizer_switch=@optimizer_switch_local_default; SET @@optimizer_switch='semijoin=on,materialization=on'; EXPLAIN SELECT COUNT(*) FROM t1 WHERE (f1,f2) IN (SELECT f1,f2 FROM t2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 7 func,func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 7 func,func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 SELECT COUNT(*) FROM t1 WHERE (f1,f2) IN (SELECT f1,f2 FROM t2); COUNT(*) 2 @@ -1571,10 +1571,10 @@ set @local_optimizer_switch=@@optimizer_switch; set @@optimizer_switch=@optimizer_switch_local_default; SET @@optimizer_switch='semijoin=on,materialization=on'; EXPLAIN SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Rowid-ordered scan SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0); pk 2 @@ -1613,9 +1613,9 @@ insert into t0 values (0),(1),(2); create table t1 (a int); insert into t1 values (0),(1),(2); explain select a, a in (select a from t1) from t0; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t0 ALL NULL NULL NULL NULL 3 -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 3 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 select a, a in (select a from t1) from t0; a a in (select a from t1) 0 1 @@ -1660,9 +1660,9 @@ insert into t2_1024 values insert into t2_1024 values (concat('1 - 03', repeat('x', @suffix_len)), concat('2 - 03', repeat('x', @suffix_len))); explain select left(a1,7), left(a2,7) from t1_1024 where (a1,3) in (select substring(b1,1,1024), count(*) from t2_1024 where b1 > '0'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 Using where -2 DEPENDENT SUBQUERY t2_1024 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1_1024 NULL ALL NULL NULL NULL NULL 3 Using where +2 DEPENDENT SUBQUERY t2_1024 NULL ALL NULL NULL NULL NULL 3 Using where select left(a1,7), left(a2,7) from t1_1024 where (a1,3) in (select substring(b1,1,1024), count(*) from t2_1024 where b1 > '0'); left(a1,7) left(a2,7) 1 - 01x 2 - 01x @@ -1891,10 +1891,10 @@ INSERT INTO t1 VALUES (8); EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN ( SELECT MIN(a) FROM t1 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system a NULL NULL NULL 1 100.00 -1 PRIMARY <subquery2> system NULL NULL NULL NULL 1 100.00 -2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system a NULL NULL NULL 1 100.00 +1 PRIMARY <subquery2> NULL system NULL NULL NULL NULL 1 100.00 +2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: Note 1003 /* select#1 */ select 8 AS `a` from dual where 1 DROP TABLE t1; @@ -1927,8 +1927,8 @@ SELECT alias3.c FROM t2 AS alias3, t2 AS alias4 WHERE alias4.c = alias3.b ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t1,t2; # # BUG#928048: Query containing IN subquery with OR in the where clause returns a wrong result @@ -1939,10 +1939,10 @@ create table t2 (a int, b int, index i_a(a)); insert into t2 values (4,2), (7,9), (7,4), (3,1), (5,3), (3,1), (9,4), (8,1); explain select * from t1 where t1.a in (select a from t2 where t2.a=7 or t2.b<=1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL i_a NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL i_a NULL NULL NULL 8 Using where select * from t1 where t1.a in (select a from t2 where t2.a=7 or t2.b<=1); a b 7 5 @@ -1970,10 +1970,10 @@ CREATE TABLE t2(a int); INSERT INTO t2 values(1),(2); # Should use Materialization: EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1.a 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t1.a 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using temporary flush status; CREATE TABLE t3 SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1); SHOW STATUS LIKE 'Created_tmp_tables'; @@ -1992,10 +1992,10 @@ INSERT INTO t2 VALUES (4), (7), (6); EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (SELECT MAX(c) FROM t2) AND b=7 AND (a IS NULL OR a=b); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL const distinct_key distinct_key 4 const 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (/* select#2 */ select max(`test`.`t2`.`c`) from `test`.`t2` having `MAX(c)` is null or `MAX(c)` = 7) join `test`.`t1` where `test`.`t1`.`b` = 7 and `test`.`t1`.`a` = `<subquery2>`.`MAX(c)` and (<cache>(/*always not null*/ 1 is null) or `<subquery2>`.`MAX(c)` = 7) SELECT * FROM t1 @@ -2005,10 +2005,10 @@ a b EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT MAX(c) FROM t2 WHERE c < 4) AND b=7 AND (a IS NULL OR a=b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL const distinct_key distinct_key 4 const 1 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT * FROM t1 WHERE a IN (SELECT MAX(c) FROM t2 WHERE c < 4) AND b=7 AND (a IS NULL OR a=b); a b @@ -2029,13 +2029,13 @@ EXPLAIN SELECT a, c FROM t1, t2 WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2 WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 index c c 5 NULL 8 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -2 MATERIALIZED s2 ref d d 4 const 2 Using where; Using index -2 MATERIALIZED s1 ALL c NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) -3 SUBQUERY t2 ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL index c c 5 NULL 8 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED s2 NULL ref d d 4 const 2 Using where; Using index +2 MATERIALIZED s1 NULL ALL c NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 SELECT a, c FROM t1, t2 WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2 WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2)); @@ -2049,13 +2049,13 @@ EXPLAIN SELECT a, c FROM t1, t2 WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2 WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 index c c 5 NULL 8 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 -2 MATERIALIZED s2 ref d d 4 const 2 Using where; Using index -2 MATERIALIZED s1 hash_ALL c #hash#$hj 5 const 8 Using where; Using join buffer (flat, BNLH join) -3 SUBQUERY t2 ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 1 +1 PRIMARY t2 NULL index c c 5 NULL 8 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED s2 NULL ref d d 4 const 2 Using where; Using index +2 MATERIALIZED s1 NULL hash_ALL c #hash#$hj 5 const 8 Using where; Using join buffer (flat, BNLH join) +3 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 SELECT a, c FROM t1, t2 WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2 WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2)); @@ -2235,10 +2235,10 @@ mysqltest2 mysqltest1 EXPLAIN EXTENDED SELECT db FROM t1 WHERE db IN (SELECT SCHEMA_NAME FROM information_schema.schemata) ORDER BY db DESC; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2 100.00 Using temporary; Using filesort -1 PRIMARY t1 eq_ref db db 764 information_schema.schemata.SCHEMA_NAME 1 100.00 Using where; Using index -2 MATERIALIZED schemata ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 100.00 Using temporary; Using filesort +1 PRIMARY t1 NULL eq_ref db db 764 information_schema.schemata.SCHEMA_NAME 1 100.00 Using where; Using index +2 MATERIALIZED schemata NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 select `test`.`t1`.`db` AS `db` from `test`.`t1` semi join (`information_schema`.`schemata`) where `test`.`t1`.`db` = `information_schema`.`schemata`.`SCHEMA_NAME` order by `test`.`t1`.`db` desc drop table t1; @@ -2281,11 +2281,11 @@ EXPLAIN SELECT sq1.f2 FROM t1 AS sq1 WHERE EXISTS ( SELECT * FROM t1 AS sq2 WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 ); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY sq1 ALL NULL NULL NULL NULL 2 Using where -2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 -2 DEPENDENT SUBQUERY sq2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY sq1 NULL ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 +2 DEPENDENT SUBQUERY sq2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 # this checks the result set above set optimizer_switch= 'materialization=off,semijoin=off'; SELECT sq1.f2 FROM t1 AS sq1 @@ -2315,12 +2315,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t2, t3 WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 DEPENDENT SUBQUERY t2 range i2 i2 5 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) -2 DEPENDENT SUBQUERY t3 ref i3 i3 5 test.t2.i2 2 100.00 Using index -3 MATERIALIZED t3 ALL NULL NULL NULL NULL 8 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 DEPENDENT SUBQUERY t2 NULL range i2 i2 5 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t3 NULL ref i3 i3 5 test.t2.i2 2 100.00 Using index +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 8 100.00 Warnings: Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`>(exists(/* select#2 */ select 1 from `test`.`t2` semi join (`test`.`t3`) join `test`.`t3` where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t1`.`f1` = `test`.`t3`.`f3` limit 1)) @@ -2354,11 +2354,11 @@ pk f1 sq EXPLAIN EXTENDED SELECT pk, f1, ( SELECT COUNT(*) FROM t2 WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 -2 DEPENDENT SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 +2 DEPENDENT SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`f1` AS `f1`,<expr_cache><`test`.`t1`.`pk`>((/* select#2 */ select count(0) from `test`.`t2` semi join (`test`.`t2`) where `test`.`t1`.`pk` = `test`.`t2`.`f2`)) AS `sq` from `test`.`t1` @@ -2410,11 +2410,11 @@ FROM t2, t3 t3_i WHERE t2.ugroup = t3_i.sys_id AND t3_i.type LIKE '59e22fb137032000158bbfc8bcbe5d52' AND t2.user = '86826bf03710200044e0bfc8bcbe5d79'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ref idx3,idx4 idx4 35 const 2 Using index condition; Using where; Start temporary -1 PRIMARY t3_i eq_ref PRIMARY PRIMARY 32 test.t2.ugroup 1 Using index condition; Using where -1 PRIMARY t1 ref idx1,idx2 idx1 35 test.t3_i.sys_id 2 Using index condition; Using where; End temporary -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 32 test.t1.assignment_group 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ref idx3,idx4 idx4 35 const 2 Using index condition; Using where; Start temporary +1 PRIMARY t3_i NULL eq_ref PRIMARY PRIMARY 32 test.t2.ugroup 1 Using index condition; Using where +1 PRIMARY t1 NULL ref idx1,idx2 idx1 35 test.t3_i.sys_id 2 Using index condition; Using where; End temporary +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 32 test.t1.assignment_group 1 Using where; Using index SELECT t1.assignment_group FROM t1, t3 WHERE t1.assignment_group = t3.sys_id AND @@ -2440,12 +2440,12 @@ FROM t2, t3 t3_i WHERE t2.ugroup = t3_i.sys_id AND t3_i.type LIKE '59e22fb137032000158bbfc8bcbe5d52' AND t2.user = '86826bf03710200044e0bfc8bcbe5d79'); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t1 ref idx1,idx2 idx1 35 test.t2.ugroup 2 Using where -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 32 test.t1.assignment_group 1 Using where; Using index -2 MATERIALIZED t2 ref idx3,idx4 idx4 35 const 2 Using index condition; Using where -2 MATERIALIZED t3_i eq_ref PRIMARY PRIMARY 32 test.t2.ugroup 1 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 +1 PRIMARY t1 NULL ref idx1,idx2 idx1 35 test.t2.ugroup 2 Using where +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 32 test.t1.assignment_group 1 Using where; Using index +2 MATERIALIZED t2 NULL ref idx3,idx4 idx4 35 const 2 Using index condition; Using where +2 MATERIALIZED t3_i NULL eq_ref PRIMARY PRIMARY 32 test.t2.ugroup 1 Using index condition; Using where SELECT t1.assignment_group FROM t1, t3 WHERE t1.assignment_group = t3.sys_id AND @@ -2475,10 +2475,10 @@ CREATE TABLE t2 (i1 int NOT NULL, i2 int NOT NULL) ; INSERT INTO t2 VALUES (11,11),(12,12),(13,13); explain SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 9 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 9 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2); 1 1 @@ -2488,10 +2488,10 @@ set @@join_cache_level= @save_join_cache_level; alter table t1 add key(id); explain SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index id id 4 NULL 9 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index id id 4 NULL 9 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2); 1 1 @@ -2545,10 +2545,10 @@ CREATE TABLE t2 (i1 int NOT NULL, i2 int NOT NULL); INSERT INTO t2 VALUES (11,11),(12,12),(13,13); CREATE VIEW v1 AS SELECT t2.i1 FROM t2 where t2.i1 = t2.i2; explain SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index id id 4 NULL 9 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL index id id 4 NULL 9 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 Using where SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1); 1 1 @@ -2596,11 +2596,11 @@ id a b id a explain extended select * from t1 left join t4 on t1.b = t4.id where f1(t1.id, '1980-01-01') in (select id from t2 where x=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 Using where -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t4`.`id` AS `id`,`test`.`t4`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) left join `test`.`t4` on(`test`.`t4`.`id` = `test`.`t1`.`b`) where `test`.`t2`.`x` = 1 and `f1`(`test`.`t1`.`id`,'1980-01-01') = `test`.`t2`.`id` # Non-deterministic function in left part of IN subq: semi-join is OK @@ -2614,11 +2614,11 @@ id a b id a explain extended select * from t1 left join t4 on t1.b = t4.id where f2(t1.id, '1980-01-01') in (select id from t2 where x=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 Using where -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t4`.`id` AS `id`,`test`.`t4`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) left join `test`.`t4` on(`test`.`t4`.`id` = `test`.`t1`.`b`) where `test`.`t2`.`x` = 1 and `f2`(`test`.`t1`.`id`,'1980-01-01') = `test`.`t2`.`id` select t1.*, t4.*, @@ -2633,12 +2633,12 @@ explain extended select t1.*, t4.*, (select max(t4.id) from t4 where t4.id=t1.b and sleep(0) = 0) as s from t1 left join t4 on t1.b = t4.id where f2(t1.id, '1980-01-01') in (select id from t2 where x=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 Using where -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t4`.`id` AS `id`,`test`.`t4`.`a` AS `a`,(/* select#2 */ select max(`test`.`t4`.`id`) from `test`.`t4` where `test`.`t4`.`id` = `test`.`t1`.`b` and sleep(0) = 0) AS `s` from `test`.`t1` semi join (`test`.`t2`) left join `test`.`t4` on(`test`.`t4`.`id` = `test`.`t1`.`b`) where `test`.`t2`.`x` = 1 and `f2`(`test`.`t1`.`id`,'1980-01-01') = `test`.`t2`.`id` @@ -2663,10 +2663,10 @@ create table t3 as select * from t2 limit 1; # The testcase only makes sense if the following uses Materialization: explain select * from t1 where (a,b) in (select max(a),b from t2 group by b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 1000 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4000 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 1000 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4000 Using temporary flush status; replace into t3 select * from t1 where (a,b) in (select max(a),b from t2 group by b); diff --git a/mysql-test/main/subselect_sj_mat.test b/mysql-test/main/subselect_sj_mat.test index 8d5bbd8ef82..02593f22913 100644 --- a/mysql-test/main/subselect_sj_mat.test +++ b/mysql-test/main/subselect_sj_mat.test @@ -82,29 +82,29 @@ select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' gr select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1); # indexed columns ---replace_column 7 # +--replace_column 8 # --replace_regex /it1.*/_it1_idx/ /test.t2i.*/_ref_/ /Using index$// /Using where$// explain extended select * from t1i where a1 in (select b1 from t2i where b1 > '0'); select * from t1i where a1 in (select b1 from t2i where b1 > '0'); ---replace_column 6 # 8 # 11 # +--replace_column 7 # 9 # 12 # explain extended select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1); select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1); ---replace_column 7 # +--replace_column 8 # --replace_regex /it1.*/_it1_idx/ /test.t2i.*/_ref_/ /Using index$// /Using where$// explain extended select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0'); select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0'); ---replace_column 6 # 7 # 8 # 11 # +--replace_column 7 # 8 # 9 # 12 # explain extended select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1); select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1); ---replace_column 6 # 7 # 8 # 11 # +--replace_column 7 # 8 # 9 # 12 # explain extended select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); @@ -208,7 +208,7 @@ where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and (a1, a2) in (select c1, c2 from t3 where (c1, c2) in (select b1, b2 from t2i where b2 > '0')); ---replace_column 6 # 7 # 8 # 11 # +--replace_column 7 # 8 # 9 # 12 # explain extended select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and @@ -250,7 +250,7 @@ where (a1, a2) in (select b1, b2 from t2 # multiple levels of nesting subqueries, unions ---replace_column 6 # 7 # 8 # 11 # +--replace_column 7 # 8 # 9 # 12 # explain extended (select * from t1 where (a1, a2) in (select b1, b2 from t2 diff --git a/mysql-test/main/subselect_sj_nonmerged.result b/mysql-test/main/subselect_sj_nonmerged.result index 422af02c31a..b96b00fc80a 100644 --- a/mysql-test/main/subselect_sj_nonmerged.result +++ b/mysql-test/main/subselect_sj_nonmerged.result @@ -7,10 +7,10 @@ insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t1 as select * from t0; # The following should use full scan on <subquery2> and it must scan 1 row: explain select * from t0 where a in (select max(a) from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 1 -1 PRIMARY t0 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 1 +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 10 select * from t0 where a in (select max(a) from t1); a 9 @@ -39,51 +39,51 @@ alter table t3 add primary key(a); # The following should have do a full scan on <subquery2> and scan 5 rows # (despite that subquery's join output estimate is 50 rows) explain select * from t3 where a in (select max(t2.a) from t1, t2 group by t2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5 -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 8 <subquery2>.max(t2.a) 1 Using where; Using index -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using temporary -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 5 +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 8 <subquery2>.max(t2.a) 1 Using where; Using index +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 Using temporary +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) # Compare to this which really will have 50 record combinations: explain select * from t3 where a in (select max(t2.a) from t1, t2 group by t2.b, t1.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 index PRIMARY PRIMARY 8 NULL 100 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t3.a 1 Using where -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using temporary -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL index PRIMARY PRIMARY 8 NULL 100 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t3.a 1 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 Using temporary +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) SET @save_optimizer_switch=@@optimizer_switch; SET optimizer_switch='outer_join_with_cache=off'; # Outer joins also work: explain select * from t3 where a in (select max(t2.a) from t1 left join t2 on t1.a=t2.a group by t2.b, t1.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 index PRIMARY PRIMARY 8 NULL 100 Using index -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t3.a 1 Using where -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 Using temporary -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t3 NULL index PRIMARY PRIMARY 8 NULL 100 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t3.a 1 Using where +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 10 Using temporary +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 Using where SET optimizer_switch=@save_optimizer_switch; create table t4 (a int, b int, filler char(20), unique key(a,b)); insert into t4 select A.a + 10*B.a, A.a + 10*B.a, 'filler' from t0 A, t0 B; explain select * from t0, t4 where t4.b=t0.a and t4.a in (select max(t2.a) from t1, t2 group by t2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5 -1 PRIMARY t0 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t4 eq_ref a a 10 <subquery2>.max(t2.a),test.t0.a 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using temporary -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 5 +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t4 NULL eq_ref a a 10 <subquery2>.max(t2.a),test.t0.a 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 Using temporary +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) insert into t4 select 100 + (B.a *100 + A.a), 100 + (B.a*100 + A.a), 'filler' from t4 A, t0 B; explain select * from t4 where t4.a in (select max(t2.a) from t1, t2 group by t2.b) and t4.b in (select max(t2.a) from t1, t2 group by t2.b); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery3> ALL distinct_key NULL NULL NULL 5 -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5 Using join buffer (flat, BNL join) -1 PRIMARY t4 eq_ref a a 10 <subquery2>.max(t2.a),<subquery3>.max(t2.a) 1 -3 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using temporary -3 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using temporary -2 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery3> NULL ALL distinct_key NULL NULL NULL 5 +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 5 Using join buffer (flat, BNL join) +1 PRIMARY t4 NULL eq_ref a a 10 <subquery2>.max(t2.a),<subquery3>.max(t2.a) 1 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 Using temporary +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 Using temporary +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) drop table t1,t2,t3,t4; drop table t0; # @@ -113,10 +113,10 @@ create table t1(a int, key(a)); insert into t1 select A.a + 10*B.a + 100*C.a from t0 A, t0 B, t0 C; # The following must use non-merged SJ-Materialization: explain select * from t1 X join t0 Y on X.a < Y.a where X.a in (select max(a) from t0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 1 -1 PRIMARY X ref a a 5 <subquery2>.max(a) 1 Using index -1 PRIMARY Y ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) -2 MATERIALIZED t0 ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 1 +1 PRIMARY X NULL ref a a 5 <subquery2>.max(a) 1 Using index +1 PRIMARY Y NULL ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t0 NULL ALL NULL NULL NULL NULL 10 drop table t0, t1; set optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/main/symlink-aria-11902.result b/mysql-test/main/symlink-aria-11902.result index 4d8f179dac9..8fdcb094a7a 100644 --- a/mysql-test/main/symlink-aria-11902.result +++ b/mysql-test/main/symlink-aria-11902.result @@ -23,8 +23,8 @@ create table t1 (a int, b char(16), index (a)) index directory="MYSQLTEST_VARDIR/tmp/foo"; insert t1 values (200, 'some'),(201,'some'); explain select a from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 2 Using index select a from t1; a 200 diff --git a/mysql-test/main/symlink-myisam-11902.result b/mysql-test/main/symlink-myisam-11902.result index bc9a0316bab..64fe35f4209 100644 --- a/mysql-test/main/symlink-myisam-11902.result +++ b/mysql-test/main/symlink-myisam-11902.result @@ -22,8 +22,8 @@ create table t1 (a int, b char(16), index (a)) index directory="MYSQLTEST_VARDIR/tmp/foo"; insert t1 values (200, 'some'),(201,'some'); explain select a from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 2 Using index select a from t1; a 200 diff --git a/mysql-test/main/table_elim.result b/mysql-test/main/table_elim.result index deff0623370..7fff48f9e9e 100644 --- a/mysql-test/main/table_elim.result +++ b/mysql-test/main/table_elim.result @@ -11,11 +11,11 @@ create table t3 (a int primary key, b int) as select a, a as b from t1 where a in (1,3); # This will be eliminated: explain select t1.a from t1 left join t2 on t2.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 explain extended select t1.a from t1 left join t2 on t2.a=t1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 select t1.a from t1 left join t2 on t2.a=t1.a; @@ -26,58 +26,58 @@ a 3 # This will not be eliminated as t2.b is in in select list: explain select * from t1 left join t2 on t2.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where # This will not be eliminated as t2.b is in in order list: explain select t1.a from t1 left join t2 on t2.a=t1.a order by t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where # This will not be eliminated as t2.b is in group list: explain select t1.a from t1 left join t2 on t2.a=t1.a group by t2.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where # This will not be eliminated as t2.b is in the WHERE explain select t1.a from t1 left join t2 on t2.a=t1.a where t2.b < 3 or t2.b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where # Elimination of multiple tables: explain select t1.a from t1 left join (t2 join t3) on t2.a=t1.a and t3.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 # Elimination of multiple tables (2): explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and t3.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 # Elimination when done within an outer join nest: explain extended select t0.* from t0 left join (t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and t3.a=t1.a) on t0.a=t1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t0 ALL NULL NULL NULL NULL 4 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t0` left join (`test`.`t1`) on(`test`.`t1`.`a` = `test`.`t0`.`a`) where 1 # Elimination with aggregate functions explain select count(*) from t1 left join t2 on t2.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 explain select count(1) from t1 left join t2 on t2.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 explain select count(1) from t1 left join t2 on t2.a=t1.a group by t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using temporary; Using filesort This must not use elimination: explain select count(1) from t1 left join t2 on t2.a=t1.a group by t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index drop table t0, t1, t2, t3; create table t0 ( id integer, primary key (id)); create table t1 ( @@ -118,57 +118,57 @@ a2.fromdate=(select MAX(fromdate) from t2 where id=f.id); This should use one table: explain select id from v1 where id=2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY f const PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY f NULL const PRIMARY PRIMARY 4 const 1 Using index This should use one table: explain extended select id from v1 where id in (1,2,3,4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY f range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY f NULL range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.a2.id' of SELECT #3 was resolved in SELECT #2 Note 1003 /* select#1 */ select `f`.`id` AS `id` from `test`.`t0` `f` where `f`.`id` in (1,2,3,4) This should use facts and a1 tables: explain extended select id from v1 where attr1 between 12 and 14; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY a1 range PRIMARY,attr1 attr1 5 NULL 2 100.00 Using index condition -1 PRIMARY f eq_ref PRIMARY PRIMARY 4 test.a1.id 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY a1 NULL range PRIMARY,attr1 attr1 5 NULL 2 100.00 Using index condition +1 PRIMARY f NULL eq_ref PRIMARY PRIMARY 4 test.a1.id 1 100.00 Using index Warnings: Note 1276 Field or reference 'test.a2.id' of SELECT #3 was resolved in SELECT #2 Note 1003 /* select#1 */ select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t1` `a1` where `f`.`id` = `a1`.`id` and `a1`.`attr1` between 12 and 14 This should use facts, a2 and its subquery: explain extended select id from v1 where attr2 between 12 and 14; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY a2 range PRIMARY,attr2 attr2 5 NULL 4 100.00 Using index condition; Using where -1 PRIMARY f eq_ref PRIMARY PRIMARY 4 test.a2.id 1 100.00 Using index -3 DEPENDENT SUBQUERY t2 ref PRIMARY PRIMARY 4 test.a2.id 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY a2 NULL range PRIMARY,attr2 attr2 5 NULL 4 100.00 Using index condition; Using where +1 PRIMARY f NULL eq_ref PRIMARY PRIMARY 4 test.a2.id 1 100.00 Using index +3 DEPENDENT SUBQUERY t2 NULL ref PRIMARY PRIMARY 4 test.a2.id 2 100.00 Using index Warnings: Note 1276 Field or reference 'test.a2.id' of SELECT #3 was resolved in SELECT #2 Note 1003 /* select#1 */ select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t2` `a2` where `f`.`id` = `a2`.`id` and `a2`.`attr2` between 12 and 14 and `a2`.`fromdate` = <expr_cache><`a2`.`id`>((/* select#3 */ select max(`test`.`t2`.`fromdate`) from `test`.`t2` where `test`.`t2`.`id` = `a2`.`id`)) This should use one table: explain select id from v2 where id=2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY f const PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY f NULL const PRIMARY PRIMARY 4 const 1 Using index This should use one table: explain extended select id from v2 where id in (1,2,3,4); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY f range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY f NULL range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index Warnings: Note 1276 Field or reference 'test.f.id' of SELECT #3 was resolved in SELECT #2 Note 1003 /* select#1 */ select `f`.`id` AS `id` from `test`.`t0` `f` where `f`.`id` in (1,2,3,4) This should use facts and a1 tables: explain extended select id from v2 where attr1 between 12 and 14; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY a1 range PRIMARY,attr1 attr1 5 NULL 2 100.00 Using index condition -1 PRIMARY f eq_ref PRIMARY PRIMARY 4 test.a1.id 1 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY a1 NULL range PRIMARY,attr1 attr1 5 NULL 2 100.00 Using index condition +1 PRIMARY f NULL eq_ref PRIMARY PRIMARY 4 test.a1.id 1 100.00 Using index Warnings: Note 1276 Field or reference 'test.f.id' of SELECT #3 was resolved in SELECT #2 Note 1003 /* select#1 */ select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t1` `a1` where `f`.`id` = `a1`.`id` and `a1`.`attr1` between 12 and 14 This should use facts, a2 and its subquery: explain extended select id from v2 where attr2 between 12 and 14; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY a2 range PRIMARY,attr2 attr2 5 NULL 4 100.00 Using index condition -1 PRIMARY f eq_ref PRIMARY PRIMARY 4 test.a2.id 1 100.00 Using where; Using index -3 DEPENDENT SUBQUERY t2 ref PRIMARY PRIMARY 4 test.f.id 2 100.00 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY a2 NULL range PRIMARY,attr2 attr2 5 NULL 4 100.00 Using index condition +1 PRIMARY f NULL eq_ref PRIMARY PRIMARY 4 test.a2.id 1 100.00 Using where; Using index +3 DEPENDENT SUBQUERY t2 NULL ref PRIMARY PRIMARY 4 test.f.id 2 100.00 Using index Warnings: Note 1276 Field or reference 'test.f.id' of SELECT #3 was resolved in SELECT #2 Note 1003 /* select#1 */ select `f`.`id` AS `id` from `test`.`t0` `f` join `test`.`t2` `a2` where `f`.`id` = `a2`.`id` and `a2`.`attr2` between 12 and 14 and `a2`.`fromdate` = <expr_cache><`f`.`id`>((/* select#3 */ select max(`test`.`t2`.`fromdate`) from `test`.`t2` where `test`.`t2`.`id` = `f`.`id`)) @@ -182,27 +182,27 @@ This must use only t1: explain select t1.* from t1 left join t2 on t2.pk1=t1.a and t2.pk2=t2.pk1+1 and t2.pk3=t2.pk2+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 This must use only t1: explain select t1.* from t1 left join t2 on t2.pk1=t1.a and t2.pk3=t2.pk1+1 and t2.pk2=t2.pk3+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 This must use both: explain select t1.* from t1 left join t2 on t2.pk1=t1.a and t2.pk3=t2.pk1+1 and t2.pk2=t2.pk3+t2.col; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a 1 Using where This must use only t1: explain select t1.* from t1 left join t2 on t2.pk2=t1.a and t2.pk1=t2.pk2+1 and t2.pk3=t2.pk1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 drop table t1, t2; create table t1 (pk int primary key, col int); insert into t1 values (1,1),(2,2); @@ -212,29 +212,29 @@ create table t3 like t1; insert into t3 select * from t1; explain select t1.* from t1 left join ( t2 left join t3 on t3.pk=t2.col) on t2.col=t1.col; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where explain select t1.*, t2.* from t1 left join (t2 left join t3 on t3.pk=t2.col) on t2.pk=t1.col; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.col 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.col 1 Using where explain select t1.* from t1 left join ( t2 left join t3 on t3.pk=t2.col or t3.pk=t2.col) on t2.col=t1.col or t2.col=t1.col; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where explain select t1.*, t2.* from t1 left join (t2 left join t3 on t3.pk=t2.col or t3.pk=t2.col) on t2.pk=t1.col or t2.pk=t1.col; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.col 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.col 1 Using where drop table t1, t2, t3; # # Check things that look like functional dependencies but really are not @@ -247,14 +247,14 @@ insert into t2 values ('foo'); insert into t2 values ('FOO'); this must not use table elimination: explain select t1.* from t1 left join t2 on t2.a='foo' collate latin1_general_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 10 NULL 2 Using index -1 SIMPLE t2 index PRIMARY PRIMARY 10 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 10 NULL 2 Using index +1 SIMPLE t2 NULL index PRIMARY PRIMARY 10 NULL 2 Using where; Using index this must not use table elimination: explain select t1.* from t1 left join t2 on t2.a=t1.a collate latin1_general_ci; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 10 NULL 2 Using index -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 10 NULL 2 Using index +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) drop table t1,t2; create table t1 (a int primary key); insert into t1 values (1),(2); @@ -262,14 +262,14 @@ create table t2 (a char(10) primary key); insert into t2 values ('1'),('1.0'); this must not use table elimination: explain select t1.* from t1 left join t2 on t2.a=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index -1 SIMPLE t2 index PRIMARY PRIMARY 10 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 Using index +1 SIMPLE t2 NULL index PRIMARY PRIMARY 10 NULL 2 Using where; Using index this must not use table elimination: explain select t1.* from t1 left join t2 on t2.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 Using index +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 2 Range checked for each record (index map: 0x1) drop table t1, t2; create table t1 (a char(10) primary key); insert into t1 values ('foo'),('bar'); @@ -277,9 +277,9 @@ create table t2 (a char(10), unique key(a(2))); insert into t2 values ('foo'),('bar'),('boo'),('car'),('coo'),('par'),('doo'),('tar'); explain select t1.* from t1 left join t2 on t2.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 10 NULL 2 Using index -1 SIMPLE t2 eq_ref a a 3 test.t1.a 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 10 NULL 2 Using index +1 SIMPLE t2 NULL eq_ref a a 3 test.t1.a 1 Using where drop table t1, t2; # # check UPDATE/DELETE that look like they could be eliminated @@ -320,40 +320,40 @@ as select a as pk, a as b from t1 where a in (1,2); create table t3 (pk1 int, pk2 int, b int, unique(pk1,pk2)); insert into t3 select a as pk1, a as pk2, a as b from t1 where a in (1,3); explain select t1.a from t1 left join t2 on t2.pk=t1.a and t2.b<t1.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 explain select t1.a from t1 left join t2 on t2.pk=t1.a or t2.b<t1.b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 2 Using where explain select t1.a from t1 left join t2 on t2.b<t1.b or t2.pk=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 2 Using where explain select t1.a from t1 left join t2 on t2.pk between 10 and 20; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using where; Using index explain select t1.a from t1 left join t2 on t2.pk between 0.5 and 1.5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Using index explain select t1.a from t1 left join t2 on t2.pk between 10 and 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 explain select t1.a from t1 left join t2 on t2.pk in (10); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 explain select t1.a from t1 left join t2 on t2.pk in (t1.a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 explain select t1.a from t1 left join t2 on TRUE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 2 Using where; Using index explain select t1.a from t1 left join t3 on t3.pk1=t1.a and t3.pk2 IS NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 drop table t1,t2,t3; # # Multi-equality tests @@ -366,8 +366,8 @@ explain select t1.* from t1 left join t2 on t2.pk=t2.c and t2.b=t1.a and t1.a=t1.b and t2.c=t2.b where t1.d=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where explain select t1.* from @@ -377,8 +377,8 @@ t2 on (t2.pk=t2.c and t2.b=t1.a and t1.a=t1.b and t2.c=t2.b) or (t2.pk=t2.c and t2.b=t1.a and t1.a=t1.b and t2.c=t2.b) where t1.d=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where #This can't be eliminated: explain select t1.* @@ -389,9 +389,9 @@ t2 on (t2.pk=t2.c and t2.b=t1.a and t2.c=t1.b) or (t2.pk=t2.c and t1.a=t1.b and t2.c=t1.b) where t1.d=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where explain select t1.* from @@ -401,25 +401,25 @@ t2 on (t2.pk=t2.c and t2.b=t1.a and t2.c=t1.b) or (t2.pk=t2.c and t2.c=t1.b) ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 explain select t1.* from t1 left join t2 on t2.pk=3 or t2.pk= 4; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Using index explain select t1.* from t1 left join t2 on t2.pk=3 or t2.pk= 3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 explain select t1.* from t1 left join t2 on (t2.pk=3 and t2.b=3) or (t2.pk= 4 and t2.b=3); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 2 Using where drop table t1, t2; # # LPBUG#523593: Running RQG optimizer_no_subquery crashes MariaDB @@ -561,11 +561,11 @@ LEFT JOIN t4 LEFT JOIN t1 ON t4.f1 = t1.f1 JOIN t5 ON t4.f3 ON t3.f1 = t5.f5 ON t2.f4 = t3.f4 WHERE t3.f2 ; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t5 ref f5 f5 5 test.t3.f1 2 Using where; Using index -1 SIMPLE t4 ALL NULL NULL NULL NULL 3 Using where -1 SIMPLE t2 ALL f4 NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t5 NULL ref f5 f5 5 test.t3.f1 2 Using where; Using index +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t2 NULL ALL f4 NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) # ^^ The above must not produce a QEP of t3,t5,t2,t4 # as that violates the "no interleaving of outer join nests" rule. DROP TABLE t1,t2,t3,t4,t5; @@ -604,10 +604,10 @@ SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b ); a b NULL NULL EXPLAIN SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b ); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 1 -1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index drop view v1; DROP TABLE t1,t2,t3; # @@ -651,9 +651,9 @@ SELECT * FROM t2 WHERE b IN ( SELECT SUM(a) FROM t1 LEFT JOIN t2 ON b=a ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 index NULL b 5 NULL 2 100.00 Using where; Using index -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL b 5 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where <expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,<exists>(/* select#2 */ select sum(1) from dual where 1 having <cache>(`test`.`t2`.`b`) = <ref_null_helper>(sum(1))))) DROP TABLE t1,t2; diff --git a/mysql-test/main/table_elim_debug.result b/mysql-test/main/table_elim_debug.result index ae49b1433fd..6253d64f6e4 100644 --- a/mysql-test/main/table_elim_debug.result +++ b/mysql-test/main/table_elim_debug.result @@ -4,19 +4,19 @@ insert into t1 values (0),(1),(2),(3); create table t2 (a int primary key, b int) as select a, a as b from t1 where a in (1,2); explain select t1.a from t1 left join t2 on t2.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 set optimizer_switch='table_elimination=off'; explain select t1.a from t1 left join t2 on t2.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index set optimizer_switch='table_elimination=on'; explain select t1.a from t1 left join t2 on t2.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 set optimizer_switch='table_elimination=default'; explain select t1.a from t1 left join t2 on t2.a=t1.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 drop table t1, t2; diff --git a/mysql-test/main/table_value_constr.result b/mysql-test/main/table_value_constr.result index 0522e6ae6cc..4450b3b5dc2 100644 --- a/mysql-test/main/table_value_constr.result +++ b/mysql-test/main/table_value_constr.result @@ -742,20 +742,20 @@ a b 1 1 explain extended select * from t1 where a in (values (1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -3 MATERIALIZED <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1)) `tvc_0`) where 1 explain extended select * from t1 where a in (select * from (values (1)) as tvc_0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1)) `tvc_0`) where 1 # IN-subquery with VALUES structure(s) : UNION with VALUES on the first place @@ -774,23 +774,23 @@ a b 2 5 explain extended select * from t1 where a in (values (1) union select 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -4 DEPENDENT SUBQUERY <derived2> ref key0 key0 4 func 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union4,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +4 DEPENDENT SUBQUERY <derived2> NULL ref key0 key0 4 func 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union4,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#4 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`1` union /* select#3 */ select 2 having <cache>(`test`.`t1`.`a`) = <ref_null_helper>(2)))) explain extended select * from t1 where a in (select * from (values (1)) as tvc_0 union select 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY <derived3> ref key0 key0 4 func 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY <derived3> NULL ref key0 key0 4 func 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`1` union /* select#4 */ select 2 having <cache>(`test`.`t1`.`a`) = <ref_null_helper>(2)))) # IN-subquery with VALUES structure(s) : UNION with VALUES on the second place @@ -809,23 +809,23 @@ a b 2 5 explain extended select * from t1 where a in (select 2 union values (1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 DEPENDENT UNION <derived3> ref key0 key0 4 func 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 DEPENDENT UNION <derived3> NULL ref key0 key0 4 func 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select 2 having <cache>(`test`.`t1`.`a`) = <ref_null_helper>(2) union /* select#4 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`1`))) explain extended select * from t1 where a in (select 2 union select * from (values (1)) tvc_0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION <derived4> ref key0 key0 4 func 2 100.00 -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION <derived4> NULL ref key0 key0 4 func 2 100.00 +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select 2 having <cache>(`test`.`t1`.`a`) = <ref_null_helper>(2) union /* select#3 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`1`))) # IN-subquery with VALUES structure(s) : UNION ALL @@ -846,21 +846,21 @@ a b 7 8 explain extended select * from t1 where a in (values (1) union all select b from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -4 DEPENDENT SUBQUERY <derived2> ref key0 key0 4 func 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 6 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +4 DEPENDENT SUBQUERY <derived2> NULL ref key0 key0 4 func 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#4 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`1` union all /* select#3 */ select `test`.`t1`.`b` from `test`.`t1` where <cache>(`test`.`t1`.`a`) = `test`.`t1`.`b`))) explain extended select * from t1 where a in (select * from (values (1)) as tvc_0 union all select b from t1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY <derived3> ref key0 key0 4 func 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 6 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY <derived3> NULL ref key0 key0 4 func 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 DEPENDENT UNION t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`1` union all /* select#4 */ select `test`.`t1`.`b` from `test`.`t1` where <cache>(`test`.`t1`.`a`) = `test`.`t1`.`b`))) # NOT IN subquery with VALUES structure(s) : simple case @@ -878,18 +878,18 @@ a b 7 8 explain extended select * from t1 where a not in (values (1),(2)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -3 MATERIALIZED <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +3 MATERIALIZED <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#3 */ select `tvc_0`.`1` from (values (1),(2)) `tvc_0` ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery3>`.`1`)))) explain extended select * from t1 where a not in (select * from (values (1),(2)) as tvc_0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (/* select#2 */ select `tvc_0`.`1` from (values (1),(2)) `tvc_0` ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where `test`.`t1`.`a` = `<subquery2>`.`1`)))) # NOT IN subquery with VALUES structure(s) : UNION with VALUES on the first place @@ -908,23 +908,23 @@ a b 7 8 explain extended select * from t1 where a not in (values (1) union select 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -4 DEPENDENT SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union4,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +4 DEPENDENT SUBQUERY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union4,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#4 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`1`) union /* select#3 */ select 2 having trigcond(<cache>(`test`.`t1`.`a`) = <ref_null_helper>(2))))) explain extended select * from t1 where a not in (select * from (values (1)) as tvc_0 union select 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 100.00 Using where -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`1`) union /* select#4 */ select 2 having trigcond(<cache>(`test`.`t1`.`a`) = <ref_null_helper>(2))))) # NOT IN subquery with VALUES structure(s) : UNION with VALUES on the second place @@ -943,23 +943,23 @@ a b 7 8 explain extended select * from t1 where a not in (select 2 union values (1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 DEPENDENT UNION <derived3> ALL NULL NULL NULL NULL 2 100.00 Using where -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 DEPENDENT UNION <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select 2 having trigcond(<cache>(`test`.`t1`.`a`) = <ref_null_helper>(2)) union /* select#4 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`1`)))) explain extended select * from t1 where a not in (select 2 union select * from (values (1)) as tvc_0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION <derived4> ALL NULL NULL NULL NULL 2 100.00 Using where -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION <derived4> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select 2 having trigcond(<cache>(`test`.`t1`.`a`) = <ref_null_helper>(2)) union /* select#3 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`1`)))) # ANY-subquery with VALUES structure(s) : simple case @@ -977,20 +977,20 @@ a b 2 5 explain extended select * from t1 where a = any (values (1),(2)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00 -3 MATERIALIZED <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where 1 explain extended select * from t1 where a = any (select * from (values (1),(2)) as tvc_0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where 1 # ANY-subquery with VALUES structure(s) : UNION with VALUES on the first place @@ -1009,23 +1009,23 @@ a b 2 5 explain extended select * from t1 where a = any (values (1) union select 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -4 DEPENDENT SUBQUERY <derived2> ref key0 key0 4 func 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union4,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +4 DEPENDENT SUBQUERY <derived2> NULL ref key0 key0 4 func 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union4,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#4 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`1` union /* select#3 */ select 2 having <cache>(`test`.`t1`.`a`) = <ref_null_helper>(2)))) explain extended select * from t1 where a = any (select * from (values (1)) as tvc_0 union select 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY <derived3> ref key0 key0 4 func 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY <derived3> NULL ref key0 key0 4 func 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`1` union /* select#4 */ select 2 having <cache>(`test`.`t1`.`a`) = <ref_null_helper>(2)))) # ANY-subquery with VALUES structure(s) : UNION with VALUES on the second place @@ -1044,23 +1044,23 @@ a b 2 5 explain extended select * from t1 where a = any (select 2 union values (1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 DEPENDENT UNION <derived3> ref key0 key0 4 func 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 DEPENDENT UNION <derived3> NULL ref key0 key0 4 func 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select 2 having <cache>(`test`.`t1`.`a`) = <ref_null_helper>(2) union /* select#4 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`1`))) explain extended select * from t1 where a = any (select 2 union select * from (values (1)) as tvc_0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION <derived4> ref key0 key0 4 func 2 100.00 -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION <derived4> NULL ref key0 key0 4 func 2 100.00 +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select 2 having <cache>(`test`.`t1`.`a`) = <ref_null_helper>(2) union /* select#3 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`1`))) # ALL-subquery with VALUES structure(s) : simple case @@ -1076,18 +1076,18 @@ a b 1 1 explain extended select * from t1 where a = all (values (1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -3 DEPENDENT SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +3 DEPENDENT SUBQUERY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <not>(<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#3 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where trigcond(<cache>(`test`.`t1`.`a`) <> `tvc_0`.`1`))))) explain extended select * from t1 where a = all (select * from (values (1)) as tvc_0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 100.00 Using where -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <not>(<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where trigcond(<cache>(`test`.`t1`.`a`) <> `tvc_0`.`1`))))) # ALL-subquery with VALUES structure(s) : UNION with VALUES on the first place @@ -1104,23 +1104,23 @@ a b 1 1 explain extended select * from t1 where a = all (values (1) union select 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -4 DEPENDENT SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union4,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +4 DEPENDENT SUBQUERY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union4,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <not>(<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#4 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where trigcond(<cache>(`test`.`t1`.`a`) <> `tvc_0`.`1`) union /* select#3 */ select 1 having trigcond(<cache>(`test`.`t1`.`a`) <> <ref_null_helper>(1)))))) explain extended select * from t1 where a = all (select * from (values (1)) as tvc_0 union select 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY <derived3> ALL NULL NULL NULL NULL 2 100.00 Using where -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <not>(<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where trigcond(<cache>(`test`.`t1`.`a`) <> `tvc_0`.`1`) union /* select#4 */ select 1 having trigcond(<cache>(`test`.`t1`.`a`) <> <ref_null_helper>(1)))))) # ALL-subquery with VALUES structure(s) : UNION with VALUES on the second place @@ -1137,23 +1137,23 @@ a b 1 1 explain extended select * from t1 where a = any (select 1 union values (1)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -4 DEPENDENT UNION <derived3> ref key0 key0 4 func 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,4> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +4 DEPENDENT UNION <derived3> NULL ref key0 key0 4 func 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,4> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select 1 having <cache>(`test`.`t1`.`a`) = <ref_null_helper>(1) union /* select#4 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`1`))) explain extended select * from t1 where a = any (select 1 union select * from (values (1)) as tvc_0); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 DEPENDENT UNION <derived4> ref key0 key0 4 func 2 100.00 -4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION <derived4> NULL ref key0 key0 4 func 2 100.00 +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#2 */ select 1 having <cache>(`test`.`t1`.`a`) = <ref_null_helper>(1) union /* select#3 */ select `tvc_0`.`1` from (values (1)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`1`))) # prepare statement that uses VALUES structure(s): single VALUES structure @@ -1296,8 +1296,8 @@ deallocate prepare stmt1; # explain query that uses VALUES structure(s): single VALUES structure explain values (1,2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used explain format=json values (1,2); EXPLAIN @@ -1324,26 +1324,26 @@ explain select 1,2 union values (1,2),(3,4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL explain values (1,2),(3,4) union select 1,2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL explain values (5,6) union values (1,2),(3,4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL explain format=json select 1,2 union @@ -1446,11 +1446,11 @@ union values (3,4) union values (1,2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2,3> NULL ALL NULL NULL NULL NULL NULL explain format=json select 1,2 union @@ -1499,24 +1499,24 @@ explain select 1,2 union values (1,2),(3,4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL explain values (1,2),(3,4) union all select 1,2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used explain values (1,2) union all values (1,2),(3,4); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used explain format=json values (1,2),(3,4) union all @@ -1619,10 +1619,10 @@ union all values (3,4) union all values (1,2); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used explain format=json select 1,2 union all @@ -1669,8 +1669,8 @@ EXPLAIN # analyze query that uses VALUES structure(s): single VALUES structure analyze values (1,2); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used analyze format=json values (1,2); ANALYZE @@ -1699,26 +1699,26 @@ analyze select 1,2 union values (1,2),(3,4); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 2.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL 2.00 NULL NULL analyze values (1,2),(3,4) union select 1,2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 2.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL 2.00 NULL NULL analyze values (5,6) union values (1,2),(3,4); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 3.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL 3.00 NULL NULL analyze format=json select 1,2 union @@ -1827,11 +1827,11 @@ union values (3,4) union values (1,2); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2,3> ALL NULL NULL NULL NULL NULL 2.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2,3> NULL ALL NULL NULL NULL NULL NULL 2.00 NULL NULL analyze format=json select 1,2 union @@ -1882,24 +1882,24 @@ analyze select 1,2 union values (1,2),(3,4); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 2.00 NULL NULL +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL 2.00 NULL NULL analyze values (1,2),(3,4) union all select 1,2; -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used analyze values (1,2) union all values (1,2),(3,4); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used analyze format=json values (1,2),(3,4) union all @@ -2008,10 +2008,10 @@ union all values (3,4) union all values (1,2); -id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used analyze format=json select 1,2 union all @@ -2112,9 +2112,9 @@ select * from (values (7), (5), (8), (1), (3), (8), (1)) t; 8 1 explain select * from (values (7), (5), (8), (1), (3), (8), (1)) t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 7 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 7 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used select * from (values (1,11), (7,77), (3,31), (4,42)) t; 1 11 1 11 @@ -2122,9 +2122,9 @@ select * from (values (1,11), (7,77), (3,31), (4,42)) t; 3 31 4 42 explain select * from (values (1,11), (7,77), (3,31), (4,42)) t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used select * from (values (7), (5), (8), (1) union values (3), (8), (1)) t; 7 7 @@ -2133,11 +2133,11 @@ select * from (values (7), (5), (8), (1) union values (3), (8), (1)) t; 1 3 explain select * from (values (7), (5), (8), (1) union values (3), (8), (1)) t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 7 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 7 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL select * from (values (7), (5), (8), (1) union select * from t1) t; 7 7 @@ -2148,11 +2148,11 @@ select * from (values (7), (5), (8), (1) union select * from t1) t; 3 2 explain select * from (values (7), (5), (8), (1) union select * from t1) t; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 7 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION t1 ALL NULL NULL NULL NULL 3 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 7 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION t1 NULL ALL NULL NULL NULL NULL 3 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL drop table t1; # # MDEV-16930: expression in the first row of TVC specifying derived table @@ -2197,8 +2197,8 @@ values (5), (7), (1), (3), (4) limit 2; 5 7 explain extended values (5), (7), (1), (3), (4) limit 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 values (5),(7),(1),(3),(4) limit 2 values (5), (7), (1), (3), (4) limit 2 offset 1; @@ -2206,8 +2206,8 @@ values (5), (7), (1), (3), (4) limit 2 offset 1; 7 1 explain extended values (5), (7), (1), (3), (4) limit 2 offset 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 values (5),(7),(1),(3),(4) limit 1,2 values (5), (7), (1), (3), (4) order by 1 limit 2; @@ -2215,9 +2215,9 @@ values (5), (7), (1), (3), (4) order by 1 limit 2; 1 3 explain extended values (5), (7), (1), (3), (4) order by 1 limit 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNIT RESULT <unit1> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT <unit1> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 values (5),(7),(1),(3),(4) order by 1 limit 2 values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1; @@ -2225,9 +2225,9 @@ values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1; 3 4 explain extended values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNIT RESULT <unit1> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT <unit1> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 values (5),(7),(1),(3),(4) order by 1 limit 1,2 values (5), (7), (1), (3), (4) order by 1; @@ -2238,9 +2238,9 @@ values (5), (7), (1), (3), (4) order by 1; 5 7 explain extended values (5), (7), (1), (3), (4) order by 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNIT RESULT <unit1> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT <unit1> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 values (5),(7),(1),(3),(4) order by 1 values (5,90), (7,20), (1,70), (3,50), (4,10) order by 2; @@ -2251,9 +2251,9 @@ values (5,90), (7,20), (1,70), (3,50), (4,10) order by 2; 1 70 5 90 explain extended values (5,90), (7,20), (1,70), (3,50), (4,10) order by 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNIT RESULT <unit1> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNIT RESULT <unit1> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 values (5,90),(7,20),(1,70),(3,50),(4,10) order by 2 select 2 union (values (5), (7), (1), (3), (4) limit 2); @@ -2262,10 +2262,10 @@ select 2 union (values (5), (7), (1), (3), (4) limit 2); 5 7 explain extended select 2 union (values (5), (7), (1), (3), (4) limit 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 2 AS `2` union (values (5),(7),(1),(3),(4) limit 2) select 2 union (values (5), (7), (1), (3), (4) limit 2 offset 1); @@ -2274,10 +2274,10 @@ select 2 union (values (5), (7), (1), (3), (4) limit 2 offset 1); 7 1 explain extended select 2 union (values (5), (7), (1), (3), (4) limit 2 offset 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 2 AS `2` union (values (5),(7),(1),(3),(4) limit 1,2) select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2); @@ -2286,11 +2286,11 @@ select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2); 1 3 explain extended select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION <derived2> ALL NULL NULL NULL NULL 5 100.00 Using filesort -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 Using filesort +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 2 AS `2` union (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2) select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1); @@ -2299,11 +2299,11 @@ select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1); 3 4 explain extended select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION <derived2> ALL NULL NULL NULL NULL 5 100.00 Using filesort -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 Using filesort +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 2 AS `2` union (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 1,2) (values (5), (7), (1), (3), (4) limit 2) union select 2; @@ -2312,10 +2312,10 @@ Note 1003 /* select#1 */ select 2 AS `2` union (/* select#3 */ select `tvc_0`.`5 7 2 explain extended (values (5), (7), (1), (3), (4) limit 2) union select 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (values (5),(7),(1),(3),(4) limit 2) union /* select#2 */ select 2 AS `2` (values (5), (7), (1), (3), (4) limit 2 offset 1) union select 2; @@ -2324,10 +2324,10 @@ Note 1003 (values (5),(7),(1),(3),(4) limit 2) union /* select#2 */ select 2 AS 1 2 explain extended (values (5), (7), (1), (3), (4) limit 2 offset 1) union select 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (values (5),(7),(1),(3),(4) limit 1,2) union /* select#2 */ select 2 AS `2` (values (5), (7), (1), (3), (4) order by 1 limit 2) union select 2; @@ -2336,11 +2336,11 @@ Note 1003 (values (5),(7),(1),(3),(4) limit 1,2) union /* select#2 */ select 2 A 3 2 explain extended (values (5), (7), (1), (3), (4) order by 1 limit 2) union select 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 100.00 Using filesort -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 5 100.00 Using filesort +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2) union /* select#2 */ select 2 AS `2` (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1) union select 2; @@ -2349,11 +2349,11 @@ Note 1003 (/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3) 4 2 explain extended (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1) union select 2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 100.00 Using filesort -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 5 100.00 Using filesort +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 1,2) union /* select#2 */ select 2 AS `2` select 3 union all (values (5), (7), (1), (3), (4) limit 2 offset 3); @@ -2362,9 +2362,9 @@ select 3 union all (values (5), (7), (1), (3), (4) limit 2 offset 3); 3 4 explain extended select 3 union all (values (5), (7), (1), (3), (4) limit 2 offset 3); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 /* select#1 */ select 3 AS `3` union all (values (5),(7),(1),(3),(4) limit 3,2) (values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3; @@ -2373,9 +2373,9 @@ Note 1003 /* select#1 */ select 3 AS `3` union all (values (5),(7),(1),(3),(4) l 4 3 explain extended (values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 (values (5),(7),(1),(3),(4) limit 3,2) union all /* select#2 */ select 3 AS `3` select 3 union all (values (5), (7), (1), (3), (4) order by 1 limit 2); @@ -2384,11 +2384,11 @@ select 3 union all (values (5), (7), (1), (3), (4) order by 1 limit 2); 1 3 explain extended select 3 union all (values (5), (7), (1), (3), (4) order by 1 limit 2); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION <derived2> ALL NULL NULL NULL NULL 5 100.00 Using filesort -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 Using filesort +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select 3 AS `3` union all (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2) (values (5), (7), (1), (3), (4) order by 1 limit 2) union all select 3; @@ -2397,11 +2397,11 @@ Note 1003 /* select#1 */ select 3 AS `3` union all (/* select#3 */ select `tvc_0 3 3 explain extended (values (5), (7), (1), (3), (4) order by 1 limit 2) union all select 3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 100.00 Using filesort -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 5 100.00 Using filesort +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2) union all /* select#2 */ select 3 AS `3` ( values (5), (7), (1), (3), (4) limit 2 offset 1 ) @@ -2414,11 +2414,11 @@ union explain extended ( values (5), (7), (1), (3), (4) limit 2 offset 1 ) union ( values (5), (7), (1), (3), (4) order by 1 limit 2 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION <derived2> ALL NULL NULL NULL NULL 5 100.00 Using filesort -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 Using filesort +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (values (5),(7),(1),(3),(4) limit 1,2) union (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2) ( values (5), (7), (1), (3), (4) limit 2 offset 1 ) @@ -2432,11 +2432,11 @@ union all explain extended ( values (5), (7), (1), (3), (4) limit 2 offset 1 ) union all ( values (5), (7), (1), (3), (4) order by 1 limit 2 ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION <derived2> ALL NULL NULL NULL NULL 5 100.00 Using filesort -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 Using filesort +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (values (5),(7),(1),(3),(4) limit 1,2) union all (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2) (values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3 order by 1; @@ -2445,10 +2445,10 @@ Note 1003 (values (5),(7),(1),(3),(4) limit 1,2) union all (/* select#3 */ selec 3 4 explain extended (values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3 order by 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 (values (5),(7),(1),(3),(4) limit 3,2) union all /* select#2 */ select 3 AS `3` order by 1 (values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3 order by 1; @@ -2458,11 +2458,11 @@ Note 1003 (values (5),(7),(1),(3),(4) limit 3,2) union all /* select#2 */ select 4 5 explain extended (values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3 order by 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 100.00 Using filesort -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 5 100.00 Using filesort +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 (/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 1,3) union all /* select#2 */ select 3 AS `3` order by 1 (values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3 @@ -2472,11 +2472,11 @@ order by 1 limit 2 offset 1; 4 explain extended (values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3 order by 1 limit 2 offset 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 100.00 Using filesort -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 5 100.00 Using filesort +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 (/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 1,3) union all /* select#2 */ select 3 AS `3` order by 1 limit 1,2 values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3; @@ -2683,13 +2683,13 @@ select a from t1 where a in (values (7) union values (8)); a 7 explain extended select a from t1 where a in (values (7) union values (8)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -4 DEPENDENT SUBQUERY <derived2> ref key0 key0 4 func 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -5 DEPENDENT UNION <derived3> ref key0 key0 4 func 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +4 DEPENDENT SUBQUERY <derived2> NULL ref key0 key0 4 func 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +5 DEPENDENT UNION <derived3> NULL ref key0 key0 4 func 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union4,5> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#4 */ select `tvc_0`.`7` from (values (7)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`7` union /* select#5 */ select `tvc_0`.`8` from (values (8)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`8`))) prepare stmt from "select a from t1 where a in (values (7) union values (8))"; @@ -2705,13 +2705,13 @@ a 3 1 explain extended select a from t1 where a not in (values (7) union values (8)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -4 DEPENDENT SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -5 DEPENDENT UNION <derived3> ALL NULL NULL NULL NULL 2 100.00 Using where -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +4 DEPENDENT SUBQUERY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +5 DEPENDENT UNION <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union4,5> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#4 */ select `tvc_0`.`7` from (values (7)) `tvc_0` where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`7`) union /* select#5 */ select `tvc_0`.`8` from (values (8)) `tvc_0` where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`8`)))) select a from t1 where a < all(values (7) union values (8)); @@ -2719,26 +2719,26 @@ a 3 1 explain extended select a from t1 where a < all(values (7) union values (8)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -4 SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -5 UNION <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +4 SUBQUERY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +5 UNION <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union4,5> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <not>(<in_optimizer>(`test`.`t1`.`a`,<min>(/* select#4 */ select `tvc_0`.`7` from (values (7)) `tvc_0` union /* select#5 */ select `tvc_0`.`8` from (values (8)) `tvc_0`) <= <cache>(`test`.`t1`.`a`))) select a from t1 where a >= any(values (7) union values (8)); a 7 explain extended select a from t1 where a >= any(values (7) union values (8)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -4 SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 100.00 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -5 UNION <derived3> ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +4 SUBQUERY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +5 UNION <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union4,5> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <nop>(<in_optimizer>(`test`.`t1`.`a`,<min>(/* select#4 */ select `tvc_0`.`7` from (values (7)) `tvc_0` union /* select#5 */ select `tvc_0`.`8` from (values (8)) `tvc_0`) <= <cache>(`test`.`t1`.`a`))) drop table t1; @@ -2752,9 +2752,9 @@ values (8), ((select * from t1 where a between 2 and 4)); 8 3 explain values (8), ((select * from t1 where a between 2 and 4)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 Using where values ((select * from t1 where a between 2 and 4)), ((select * from t1 where a > 10)); (select * from t1 where a between 2 and 4) @@ -2762,18 +2762,18 @@ values ((select * from t1 where a between 2 and 4)), NULL explain values ((select * from t1 where a between 2 and 4)), ((select * from t1 where a > 10)); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -3 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where -2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 Using where values (10,11), ((select * from t1 where a = 7) + 1, 21); 10 11 10 11 8 21 explain values (10,11), ((select * from t1 where a = 7) + 1, 21); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 Using where drop table t1; # # MDEV-24910: TVC containing subquery used as a subselect @@ -2787,10 +2787,10 @@ select (values ((select 2))) from t2; 2 2 explain select (values ((select 2))) from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -4 SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +4 SUBQUERY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1249 Select 3 was reduced during optimization prepare stmt from "select (values ((select 2))) from t2"; @@ -2808,11 +2808,11 @@ select (values ((select * from t1 where a > 10))) from t2; NULL NULL explain select (values ((select * from t1 where a > 10))) from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 -4 SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used -3 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 +4 SUBQUERY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 Using where prepare stmt from "select (values ((select * from t1 where a > 10))) from t2"; execute stmt; (values ((select * from t1 where a > 10))) @@ -2833,13 +2833,13 @@ select 1 explain select (values ((select * from t3 where a in (select * from v1)))); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -6 SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used -3 SUBQUERY t3 ALL NULL NULL NULL NULL 11 Using where -3 SUBQUERY <derived5> ref key0 key0 8 test.t3.a 2 Using where; FirstMatch(t3) -5 DERIVED t3 ALL NULL NULL NULL NULL 11 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +6 SUBQUERY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 11 Using where +3 SUBQUERY <derived5> NULL ref key0 key0 8 test.t3.a 2 Using where; FirstMatch(t3) +5 DERIVED t3 NULL ALL NULL NULL NULL NULL 11 Using temporary; Using filesort prepare stmt from "select (values ((select * from t3 where a in (select * from v1))))"; execute stmt; @@ -2858,13 +2858,13 @@ NULL explain select (values ((select * from t3 where a > 10 and a in (select * from v1)))); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -6 SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used -3 SUBQUERY t3 ALL NULL NULL NULL NULL 11 Using where -3 SUBQUERY <derived5> ref key0 key0 8 test.t3.a 2 Using where; FirstMatch(t3) -5 DERIVED t3 ALL NULL NULL NULL NULL 11 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +6 SUBQUERY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 11 Using where +3 SUBQUERY <derived5> NULL ref key0 key0 8 test.t3.a 2 Using where; FirstMatch(t3) +5 DERIVED t3 NULL ALL NULL NULL NULL NULL 11 Using temporary; Using filesort prepare stmt from "select (values ((select * from t3 where a > 10 and a in (select * from v1))))"; diff --git a/mysql-test/main/temporal_literal.result b/mysql-test/main/temporal_literal.result index 2197b990f3b..cf016a6e8c2 100644 --- a/mysql-test/main/temporal_literal.result +++ b/mysql-test/main/temporal_literal.result @@ -56,13 +56,13 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; EXPLAIN EXTENDED SELECT {d'2010-01-01'}; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select DATE'2010-01-01' AS `{d'2010-01-01'}` EXPLAIN EXTENDED SELECT DATE'2010-01-01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select DATE'2010-01-01' AS `DATE'2010-01-01'` # @@ -177,13 +177,13 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; EXPLAIN EXTENDED SELECT {t'10:01:01'}; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select TIME'10:01:01' AS `{t'10:01:01'}` EXPLAIN EXTENDED SELECT TIME'10:01:01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select TIME'10:01:01' AS `TIME'10:01:01'` # @@ -269,13 +269,13 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; EXPLAIN EXTENDED SELECT {ts'2010-01-01 10:10:10'}; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select TIMESTAMP'2010-01-01 10:10:10' AS `{ts'2010-01-01 10:10:10'}` EXPLAIN EXTENDED SELECT TIMESTAMP'2010-01-01 10:10:10'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select TIMESTAMP'2010-01-01 10:10:10' AS `TIMESTAMP'2010-01-01 10:10:10'` # diff --git a/mysql-test/main/tmp_table_count-7586.result b/mysql-test/main/tmp_table_count-7586.result index 637e7385685..e47c0a23c96 100644 --- a/mysql-test/main/tmp_table_count-7586.result +++ b/mysql-test/main/tmp_table_count-7586.result @@ -13,8 +13,8 @@ Created_tmp_disk_tables 0 Created_tmp_files 0 Created_tmp_tables 0 explain select * from v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 select * from (select * from t2) T1; a 1 @@ -26,8 +26,8 @@ Created_tmp_disk_tables 0 Created_tmp_files 0 Created_tmp_tables 0 explain select * from (select * from t2) T1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 drop view v2; drop table t2; CREATE TABLE t1(a int); @@ -35,10 +35,10 @@ INSERT INTO t1 values(1),(2); CREATE TABLE t2(a int); INSERT INTO t2 values(1),(2); EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1.a 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t1.a 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using temporary truncate table performance_schema.events_statements_history_long; flush status; CREATE TABLE t3 SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1); @@ -53,10 +53,10 @@ Created_tmp_files 0 Created_tmp_tables 2 drop table t3; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 truncate table performance_schema.events_statements_history_long; flush status; CREATE TABLE t3 SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a); diff --git a/mysql-test/main/type_bit.result b/mysql-test/main/type_bit.result index f44bdf70c4a..6a89724d02c 100644 --- a/mysql-test/main/type_bit.result +++ b/mysql-test/main/type_bit.result @@ -85,8 +85,8 @@ a+0 3 alter table t1 add key (a); explain select a+0 from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 2 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 2 NULL 4 Using index select a+0 from t1; a+0 0 @@ -103,8 +103,8 @@ insert into t1 values (30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403), (44, 307), (68, 454), (57, 135); explain select a+0 from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 38 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 38 Using index select a+0 from t1; a+0 0 @@ -146,8 +146,8 @@ a+0 123 127 explain select b+0 from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 38 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 38 Using index select b+0 from t1; b+0 177 @@ -189,8 +189,8 @@ b+0 411 403 explain select a+0, b+0 from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 38 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 38 Using index select a+0, b+0 from t1; a+0 b+0 0 177 @@ -232,8 +232,8 @@ a+0 b+0 123 411 127 403 explain select a+0, b+0 from t1 where a > 40 and b > 200 order by 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 2 NULL 27 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 2 NULL 27 Using where; Using index; Using filesort select a+0, b+0 from t1 where a > 40 and b > 200 order by 1; a+0 b+0 44 307 @@ -255,8 +255,8 @@ a+0 b+0 123 411 127 403 explain select a+0, b+0 from t1 where a > 40 and a < 70 order by 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 2 NULL 9 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 2 NULL 9 Using where; Using index; Using filesort select a+0, b+0 from t1 where a > 40 and a < 70 order by 2; a+0 b+0 57 135 @@ -682,8 +682,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT 1 FROM t1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 3 NULL 2 Using index for group-by +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range NULL a 3 NULL 2 Using index for group-by SELECT 1 FROM t1 GROUP BY a; 1 1 @@ -765,8 +765,8 @@ drop table t1bit7, t2bit7; CREATE TABLE t1 (a BIT(7), b BIT(9), KEY(a, b)); INSERT INTO t1 VALUES(0, 0), (5, 3), (5, 6), (6, 4), (7, 0); EXPLAIN SELECT a+0, b+0 FROM t1 WHERE a > 4 and b < 7 ORDER BY 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 2 NULL 4 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 2 NULL 4 Using where; Using index; Using filesort DROP TABLE t1; End of 5.0 tests create table t1(a bit(7)); @@ -869,11 +869,11 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a BIT(7), KEY(a)); INSERT INTO t1 VALUES (1),(2),(3),(4),(5); EXPLAIN SELECT * FROM t1 WHERE a=200; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE a<=>200; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t1; # # MDEV-23323 Rounding functions return a wrong data type for a BIT, ENUM, SET argument diff --git a/mysql-test/main/type_bit_innodb.result b/mysql-test/main/type_bit_innodb.result index a3ac23ebb71..ff333f4eeef 100644 --- a/mysql-test/main/type_bit_innodb.result +++ b/mysql-test/main/type_bit_innodb.result @@ -86,8 +86,8 @@ a+0 3 alter table t1 add key (a); explain select a+0 from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 2 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 2 NULL 4 Using index select a+0 from t1; a+0 0 @@ -104,8 +104,8 @@ insert into t1 values (30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403), (44, 307), (68, 454), (57, 135); explain select a+0 from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 38 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 38 Using index select a+0 from t1; a+0 0 @@ -147,8 +147,8 @@ a+0 123 127 explain select b+0 from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 38 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 38 Using index select b+0 from t1; b+0 177 @@ -190,8 +190,8 @@ b+0 411 403 explain select a+0, b+0 from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 5 NULL 38 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 38 Using index select a+0, b+0 from t1; a+0 b+0 0 177 @@ -233,8 +233,8 @@ a+0 b+0 123 411 127 403 explain select a+0, b+0 from t1 where a > 40 and b > 200 order by 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 2 NULL # Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 2 NULL # Using where; Using index; Using filesort select a+0, b+0 from t1 where a > 40 and b > 200 order by 1; a+0 b+0 44 307 @@ -256,8 +256,8 @@ a+0 b+0 123 411 127 403 explain select a+0, b+0 from t1 where a > 40 and a < 70 order by 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 2 NULL 9 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 2 NULL 9 Using where; Using index; Using filesort select a+0, b+0 from t1 where a > 40 and a < 70 order by 2; a+0 b+0 57 135 diff --git a/mysql-test/main/type_bit_innodb.test b/mysql-test/main/type_bit_innodb.test index 6317bbc3a2d..cfbf72009af 100644 --- a/mysql-test/main/type_bit_innodb.test +++ b/mysql-test/main/type_bit_innodb.test @@ -67,7 +67,7 @@ explain select b+0 from t1; select b+0 from t1; explain select a+0, b+0 from t1; select a+0, b+0 from t1; ---replace_column 9 # +--replace_column 10 # explain select a+0, b+0 from t1 where a > 40 and b > 200 order by 1; select a+0, b+0 from t1 where a > 40 and b > 200 order by 1; explain select a+0, b+0 from t1 where a > 40 and a < 70 order by 2; diff --git a/mysql-test/main/type_blob.result b/mysql-test/main/type_blob.result index c2739e4b166..80579c54708 100644 --- a/mysql-test/main/type_blob.result +++ b/mysql-test/main/type_blob.result @@ -525,8 +525,8 @@ explain extended select charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat')), collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat')), coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat')); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`,collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`,coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))` update t1 set imagem=load_file('MYSQLTEST_VARDIR/std_data/words.dat') where id=1; @@ -624,11 +624,11 @@ id txt 2 Chevy 3 NULL explain select * from t1 where txt='Chevy' or txt is NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null txt_index txt_index 23 const 3 Using where explain select * from t1 FORCE INDEX (`txt_index`) where txt='Chevy' or txt is NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null txt_index txt_index 23 const 3 Using where select * from t1 where txt='Chevy '; id txt 1 Chevy @@ -704,15 +704,15 @@ id txt 7 Ford alter table t1 modify column txt blob; explain select * from t1 where txt='Chevy' or txt is NULL; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null txt_index txt_index 23 const 2 Using where select * from t1 where txt='Chevy' or txt is NULL; id txt 1 Chevy 3 NULL explain select * from t1 where txt='Chevy' or txt is NULL order by txt; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref_or_null txt_index txt_index 23 const 2 Using where; Using filesort select * from t1 where txt='Chevy' or txt is NULL order by txt; id txt 3 NULL @@ -957,14 +957,14 @@ Field Type Null Key Default Extra cast(null as binary(4294967295)) binary(0) YES NULL drop table b15776; explain select cast(1 as char(4294967295)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used explain select cast(1 as nchar(4294967295)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used explain select cast(1 as binary(4294967295)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used explain select cast(1 as char(4294967296)); ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select cast(1 as nchar(4294967296)); @@ -974,8 +974,8 @@ ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select cast(1 as decimal(-1)); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-1))' at line 1 explain select cast(1 as decimal(64, 30)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used explain select cast(1 as decimal(64, 999999999999999999999999999999)); Got one of the listed errors explain select cast(1 as decimal(4294967296)); @@ -983,22 +983,22 @@ Got one of the listed errors explain select cast(1 as decimal(999999999999999999999999999999999999)); Got one of the listed errors explain select convert(1, char(4294967295)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used explain select convert(1, char(4294967296)); ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, nchar(4294967295)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used explain select convert(1, nchar(4294967296)); ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, nchar(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, binary(4294967295)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used explain select convert(1, binary(4294967296)); ERROR 42000: Display width out of range for '1' (max = 4294967295) explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); diff --git a/mysql-test/main/type_date.result b/mysql-test/main/type_date.result index 950e2a7951a..d333813ccca 100644 --- a/mysql-test/main/type_date.result +++ b/mysql-test/main/type_date.result @@ -171,28 +171,28 @@ SELECT COUNT(*) FROM t1 WHERE a = NOW(); COUNT(*) 0 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables INSERT INTO t1 VALUES (DATE(NOW()), 2); SELECT COUNT(*) FROM t1 WHERE a = NOW(); COUNT(*) 0 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT COUNT(*) FROM t1 WHERE a = NOW() AND b = 1; COUNT(*) 0 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW() AND b = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables ALTER TABLE t1 DROP PRIMARY KEY; SELECT COUNT(*) FROM t1 WHERE a = NOW(); COUNT(*) 0 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where SET timestamp=DEFAULT; DROP TABLE t1; CREATE TABLE t1 (a DATE); @@ -210,8 +210,8 @@ a 0000-00-00 SET SQL_MODE=TRADITIONAL; EXPLAIN SELECT * FROM t1 WHERE a = '0000-00-00'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref i i 4 const 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref i i 4 const 2 Using index SELECT * FROM t1 WHERE a = '0000-00-00'; a 0000-00-00 @@ -239,8 +239,8 @@ a 1000-00-00 SET SQL_MODE=TRADITIONAL; EXPLAIN SELECT * FROM t1 WHERE a = '1000-00-00'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref i i 4 const 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref i i 4 const 2 Using index SELECT * FROM t1 WHERE a = '1000-00-00'; a 1000-00-00 @@ -434,17 +434,17 @@ create table t1(a date,key(a)); insert into t1 values ('2012-01-01'),('2012-02-02'); explain select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1_0 ref a a 4 const 1 Using where; Using index -1 SIMPLE t2 index NULL a 4 NULL 2 Using index; Using join buffer (flat, BNL join) -1 SIMPLE t1 index NULL a 4 NULL 2 Using index; Using join buffer (incremental, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1_0 NULL ref a a 4 const 1 Using where; Using index +1 SIMPLE t2 NULL index NULL a 4 NULL 2 Using index; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL index NULL a 4 NULL 2 Using index; Using join buffer (incremental, BNL join) select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1; 1 SET TIMESTAMP=UNIX_TIMESTAMP('2012-01-03 00:00:01'); explain select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1; 1 drop table t1; @@ -556,13 +556,13 @@ DROP TABLE t1; CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02'); EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a BETWEEN '2001-01-01' AND '2001-01-02'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a IN ('2001-01-01','2001-01-02'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01' DROP TABLE t1; @@ -585,15 +585,15 @@ Warnings: Warning 1292 Truncated incorrect date value: '2001-01-01x' EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)!='323030312D30312D3031' AND a='2001-01-01x'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Warning 1292 Truncated incorrect date value: '2001-01-01x' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)!=CONCAT('xx',RAND()) AND a='2001-01-01x'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect date value: '2001-01-01x' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01' and <cache>(hex(DATE'2001-01-01')) <> concat('xx',rand()) @@ -606,20 +606,20 @@ SELECT * FROM t1 WHERE LENGTH(a)=11 AND a=' 2001-01-01'; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=11 AND a=' 2001-01-01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' 2001-01-01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01' and <cache>(octet_length(DATE'2001-01-01')) = 11 + rand() EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' garbage '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect datetime value: ' garbage ' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'0000-00-00' and <cache>(octet_length(DATE'0000-00-00')) = 11 + rand() @@ -632,14 +632,14 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='20010101'; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='20010101'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8+RAND() AND a='20010101'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-01' and <cache>(octet_length(DATE'2001-01-01')) = 8 + rand() DROP TABLE t1; @@ -661,14 +661,14 @@ a 2015-08-30 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-30' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-30' and <cache>(octet_length(DATE'2015-08-30')) = 30 + rand() DROP TABLE t1; @@ -686,14 +686,14 @@ a 2015-08-31 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-31' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'24:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-31' and <cache>(octet_length(DATE'2015-08-31')) = 30 + rand() DROP TABLE t1; @@ -712,14 +712,14 @@ SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00'; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'0000-00-00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'0000-00-00' and <cache>(octet_length(DATE'0000-00-00')) = 30 + rand() DROP TABLE t1; @@ -737,14 +737,14 @@ a 2015-08-30 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00' and <cache>(octet_length(DATE'2015-08-30')) = 30 + rand() DROP TABLE t1; @@ -760,14 +760,14 @@ SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1'; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00.1' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00.1'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00.1' and <cache>(octet_length(DATE'2015-08-30')) = 30 + rand() DROP TABLE t1; @@ -785,14 +785,14 @@ a 2015-08-30 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-30' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='2015-08-30 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2015-08-30' and <cache>(octet_length(DATE'2015-08-30')) = 30 + rand() DROP TABLE t1; @@ -803,8 +803,8 @@ SET timestamp=DEFAULT; CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02'); EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-01' AND COALESCE(a)>=DATE'2001-01-01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2001-01-01' DROP TABLE t1; @@ -932,8 +932,8 @@ DROP TABLE t1; CREATE TABLE t1 (f DATE, KEY(f)); INSERT INTO t1 VALUES ('2020-01-01'),('2020-01-02'); EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '2012-12-12'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range f f 4 NULL 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range f f 4 NULL 1 100.00 Using where; Using index Warnings: Warning 1292 Truncated incorrect datetime value: '1995.0000000' Note 1003 select `test`.`t1`.`f` AS `f` from `test`.`t1` where '0000-00-00' between `test`.`t1`.`f` and <cache>('2012-12-12') @@ -962,17 +962,17 @@ DROP TABLE t1; CREATE TABLE t1(a DATE,KEY(a)); INSERT INTO t1 VALUES ('2012-01-01'),('2012-02-02'); EXPLAIN SELECT 1 FROM t1 WHERE t1.a <=> TIMESTAMP'2001-01-01 00:00:01' AND TRUE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT 1 FROM t1 WHERE t1.a <=> TIMESTAMP('2001-01-01', '00:00:01') AND TRUE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT 1 FROM t1 WHERE t1.a <=> TIMESTAMP'2001-01-01 00:00:00' AND TRUE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 4 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 4 const 1 Using where; Using index EXPLAIN SELECT 1 FROM t1 WHERE t1.a <=> TIMESTAMP('2001-01-01', '00:00:00') AND TRUE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 4 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 4 const 1 Using where; Using index DROP TABLE t1; # # End of 10.3 tests @@ -987,65 +987,65 @@ CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02'),('2001-01-03'); # Equal values EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(DATE'2001:01:01',a)<=>COALESCE(DATE'2001-01-01',a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALESCE(?,a)' USING DATE'2001-01-01',DATE'2001-01-01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(DATE''2001-01-01'',a)<=>COALESCE(?,a)' USING DATE'2001-01-01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALESCE(DATE''2001-01-01'',a)' USING DATE'2001-01-01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 # Equal values but of different data types (should not propagate) EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(DATE'2001:01:01',a)<=>COALESCE(TIMESTAMP'2001-01-01 00:00:00',a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(DATE'2001-01-01',`test`.`t1`.`a`) <=> coalesce(TIMESTAMP'2001-01-01 00:00:00',`test`.`t1`.`a`) EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALESCE(?,a)' USING DATE'2001-01-01',TIMESTAMP'2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(<cache>(DATE'2001-01-01'),`test`.`t1`.`a`) <=> coalesce(<cache>(TIMESTAMP'2001-01-01 00:00:00'),`test`.`t1`.`a`) EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(DATE''2001-01-01'',a)<=>COALESCE(?,a)' USING TIMESTAMP'2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(DATE'2001-01-01',`test`.`t1`.`a`) <=> coalesce(<cache>(TIMESTAMP'2001-01-01 00:00:00'),`test`.`t1`.`a`) EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALESCE(DATE''2001-01-01'',a)' USING TIMESTAMP'2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(<cache>(TIMESTAMP'2001-01-01 00:00:00'),`test`.`t1`.`a`) <=> coalesce(DATE'2001-01-01',`test`.`t1`.`a`) # Not equal values EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(DATE'2001-01-01',a)<=>COALESCE(DATE'2001-01-02',a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(DATE'2001-01-01',`test`.`t1`.`a`) <=> coalesce(DATE'2001-01-02',`test`.`t1`.`a`) EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALESCE(?,a)' USING DATE'2001-01-01',DATE'2001-01-02'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(<cache>(DATE'2001-01-01'),`test`.`t1`.`a`) <=> coalesce(<cache>(DATE'2001-01-02'),`test`.`t1`.`a`) EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(DATE''2001-01-01'',a)<=>COALESCE(?,a)' USING DATE'2001-01-02'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(DATE'2001-01-01',`test`.`t1`.`a`) <=> coalesce(<cache>(DATE'2001-01-02'),`test`.`t1`.`a`) EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALESCE(DATE''2001-01-01'',a)' USING DATE'2001-01-02'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(<cache>(DATE'2001-01-02'),`test`.`t1`.`a`) <=> coalesce(DATE'2001-01-01',`test`.`t1`.`a`) DROP TABLE t1; diff --git a/mysql-test/main/type_date_round.result b/mysql-test/main/type_date_round.result index 0da78c6afe5..9bd4c862797 100644 --- a/mysql-test/main/type_date_round.result +++ b/mysql-test/main/type_date_round.result @@ -126,15 +126,15 @@ a Warnings: Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND a>='2001-01-01 23:59:59.9999999'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-02' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND CONCAT(a)='2001-01-02'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-02' diff --git a/mysql-test/main/type_datetime.result b/mysql-test/main/type_datetime.result index 77d77d218f0..3d22729f667 100644 --- a/mysql-test/main/type_datetime.result +++ b/mysql-test/main/type_datetime.result @@ -104,8 +104,8 @@ date numfacture expedition 0000-00-00 00:00:00 0 0001-00-00 00:00:00 0000-00-00 00:00:00 1212 0001-00-00 00:00:00 EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref expedition expedition 5 const 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref expedition expedition 5 const 2 drop table t1; create table t1 (a datetime not null, b datetime not null); insert into t1 values (now(), now()); @@ -519,8 +519,8 @@ SET optimizer_switch='semijoin_with_cache=off'; explain extended select * from t1 where id in (select id from t1 as x1 where (t1.cur_date is null)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1 Note 1003 select 1 AS `id`,'2007-04-25 18:30:22' AS `cur_date` from (dual) where 0 @@ -530,8 +530,8 @@ id cur_date explain extended select * from t2 where id in (select id from t2 as x1 where (t2.cur_date is null)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1 Note 1003 select 1 AS `id`,'2007-04-25' AS `cur_date` from (dual) where 0 @@ -543,9 +543,9 @@ insert into t2 (id, cur_date) values (2, '2007-04-26'); explain extended select * from t1 where id in (select id from t1 as x1 where (t1.cur_date is null)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -1 PRIMARY x1 ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; End temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY x1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; End temporary Warnings: Note 1276 Field or reference 'test.t1.cur_date' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`cur_date` AS `cur_date` from `test`.`t1` semi join (`test`.`t1` `x1`) where `test`.`x1`.`id` = `test`.`t1`.`id` and `test`.`t1`.`cur_date` = 0 @@ -555,9 +555,9 @@ id cur_date explain extended select * from t2 where id in (select id from t2 as x1 where (t2.cur_date is null)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where -1 PRIMARY x1 ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; End temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY x1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; End temporary Warnings: Note 1276 Field or reference 'test.t2.cur_date' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t2`.`id` AS `id`,`test`.`t2`.`cur_date` AS `cur_date` from `test`.`t2` semi join (`test`.`t2` `x1`) where `test`.`x1`.`id` = `test`.`t2`.`id` and `test`.`t2`.`cur_date` = 0 @@ -748,8 +748,8 @@ CREATE TABLE t1 (Id INT, AtTime DATETIME, KEY AtTime (AtTime)); SET NAMES CP850; INSERT INTO t1 VALUES (1,'2010-04-12 22:30:12'), (2,'2010-04-12 22:30:12'), (3,'2010-04-12 22:30:12'); EXPLAIN EXTENDED SELECT * FROM t1 FORCE INDEX(attime) WHERE AtTime = '2010-02-22 18:40:07'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref AtTime AtTime 6 const 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref AtTime AtTime 6 const 1 100.00 Warnings: Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from `test`.`t1` FORCE INDEX (`attime`) where `test`.`t1`.`AtTime` = TIMESTAMP'2010-02-22 18:40:07' DROP TABLE t1; @@ -776,8 +776,8 @@ f1 2010-04-01 00:00:00 t2 should be const explain select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 const PRIMARY PRIMARY 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 5 const 1 Using index DROP TABLE t1,t2; # # Bug#57095: Wrongly chosen expression cache type led to a wrong @@ -977,15 +977,15 @@ Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a) != 20 AND a='2001-01-01 00:00:00x'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=30+RAND() AND a='2001-01-01 00:00:00x'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and <cache>(octet_length(TIMESTAMP'2001-01-01 00:00:00')) <> 30 + rand() @@ -1001,20 +1001,20 @@ a 2001-01-01 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=19+RAND() AND a=' 2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and <cache>(octet_length(TIMESTAMP'2001-01-01 00:00:00')) = 19 + rand() EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' garbage '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect datetime value: ' garbage ' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00' and <cache>(octet_length(TIMESTAMP'0000-00-00 00:00:00')) = 30 + rand() @@ -1033,14 +1033,14 @@ a 2001-01-01 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' and <cache>(octet_length(TIMESTAMP'2001-01-01 00:00:00')) = 30 + rand() DROP TABLE t1; @@ -1058,14 +1058,14 @@ a 2001-01-01 00:00:00.000000 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=26 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' and <cache>(octet_length(TIMESTAMP'2001-01-01 00:00:00.000000')) = 40 + rand() DROP TABLE t1; @@ -1084,14 +1084,14 @@ a 2001-01-01 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIME'00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and <cache>(octet_length(TIMESTAMP'2001-01-01 00:00:00')) = 40 + rand() DROP TABLE t1; @@ -1101,8 +1101,8 @@ DROP TABLE t1; CREATE TABLE t1 (a DATETIME); INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-02 00:00:00'); EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-01 00:00:00' AND COALESCE(a)>=TIMESTAMP'2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = TIMESTAMP'2001-01-01 00:00:00' DROP TABLE t1; @@ -1339,8 +1339,8 @@ DROP TABLE t1; CREATE TABLE t1 (f DATETIME, KEY(f)); INSERT INTO t1 VALUES ('2020-01-01 00:00:00'),('2020-01-02 00:00:00'); EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '2012-12-12'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range f f 6 NULL 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range f f 6 NULL 1 100.00 Using where; Using index Warnings: Warning 1292 Truncated incorrect datetime value: '1995.0000000' Note 1003 select `test`.`t1`.`f` AS `f` from `test`.`t1` where '0000-00-00 00:00:00.000000' between `test`.`t1`.`f` and <cache>('2012-12-12') @@ -1401,8 +1401,8 @@ INSERT INTO t1 VALUES ('2001-01-01 23:00:02', 'no'); INSERT INTO t1 VALUES ('2001-01-01 23:00:03', 'yes'); INSERT INTO t1 VALUES ('2001-01-01 23:00:04', 'yes'); EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('2001-01-01 23:00:01','2001-01-01 23:00:02'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 6 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 6 NULL 4 Using index condition SELECT * FROM t1 WHERE a NOT IN ('2001-01-01 23:00:01','2001-01-01 23:00:02'); a filler 2001-01-01 23:00:03 yes @@ -1440,8 +1440,8 @@ INSERT INTO t1 VALUES ('2001-01-01 23:00:02.1', 'no'); INSERT INTO t1 VALUES ('2001-01-01 23:00:03.1', 'yes'); INSERT INTO t1 VALUES ('2001-01-01 23:00:04.1', 'yes'); EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('2001-01-01 23:00:01.1','2001-01-01 23:00:02.1'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 7 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 7 NULL 4 Using index condition SELECT * FROM t1 WHERE a NOT IN ('2001-01-01 23:00:01.1','2001-01-01 23:00:02.1'); a filler 2001-01-01 23:00:03.1 yes @@ -1460,44 +1460,44 @@ CREATE TABLE t1 (a DATETIME); INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-02 00:00:00'),('2001-01-03 00:00:00'); # Equal values EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(TIMESTAMP'2001:01:01 00:00:00',a)<=>COALESCE(TIMESTAMP'2001-01-01 00:00:00',a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALESCE(?,a)' USING TIMESTAMP'2001-01-01 00:00:00',TIMESTAMP'2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(TIMESTAMP''2001-01-01 00:00:00'',a)<=>COALESCE(?,a)' USING TIMESTAMP'2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALESCE(TIMESTAMP''2001-01-01 00:00:00'',a)' USING TIMESTAMP'2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 # Not equal values EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(TIMESTAMP'2001:01:01 00:00:00',a)<=>COALESCE(TIMESTAMP'2001-01-01 00:00:01',a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(TIMESTAMP'2001-01-01 00:00:00',`test`.`t1`.`a`) <=> coalesce(TIMESTAMP'2001-01-01 00:00:01',`test`.`t1`.`a`) EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALESCE(?,a)' USING TIMESTAMP'2001-01-01 00:00:00',TIMESTAMP'2001-01-01 00:00:01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(<cache>(TIMESTAMP'2001-01-01 00:00:00'),`test`.`t1`.`a`) <=> coalesce(<cache>(TIMESTAMP'2001-01-01 00:00:01'),`test`.`t1`.`a`) EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(TIMESTAMP''2001-01-01 00:00:00'',a)<=>COALESCE(?,a)' USING TIMESTAMP'2001-01-01 00:00:01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(TIMESTAMP'2001-01-01 00:00:00',`test`.`t1`.`a`) <=> coalesce(<cache>(TIMESTAMP'2001-01-01 00:00:01'),`test`.`t1`.`a`) EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALESCE(TIMESTAMP''2001-01-01 00:00:00'',a)' USING TIMESTAMP'2001-01-01 00:00:01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(<cache>(TIMESTAMP'2001-01-01 00:00:01'),`test`.`t1`.`a`) <=> coalesce(TIMESTAMP'2001-01-01 00:00:00',`test`.`t1`.`a`) DROP TABLE t1; @@ -1513,8 +1513,8 @@ a 2001-01-01 00:00:01 2001-01-01 00:00:02 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(COALESCE(TIMESTAMP'2001-01-01 00:00:00.0',a))<=>LENGTH(COALESCE(TIMESTAMP'2001-01-01 00:00:00.0',a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE LENGTH(COALESCE(TIME''00:00:00.0'',a))<=>LENGTH(COALESCE(?,a))' USING TIMESTAMP'2001-01-01 00:00:00.0'; @@ -1523,8 +1523,8 @@ a 2001-01-01 00:00:01 2001-01-01 00:00:02 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(COALESCE(TIME''00:00:00.0'',a))<=>LENGTH(COALESCE(?,a))' USING TIMESTAMP'2001-01-01 00:00:00.0'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where octet_length(coalesce(TIME'00:00:00.0',`test`.`t1`.`a`)) <=> octet_length(coalesce(<cache>(TIMESTAMP'2001-01-01 00:00:00.0'),`test`.`t1`.`a`)) Values with different formats @@ -1536,15 +1536,15 @@ LENGTH(COALESCE(TIMESTAMP'2001-01-01 00:00:00.0',a)) LENGTH(COALESCE(TIMESTAMP'2 SELECT * FROM t1 WHERE LENGTH(COALESCE(TIMESTAMP'2001-01-01 00:00:00.0',a))<=>LENGTH(COALESCE(TIMESTAMP'2001-01-01 00:00:00.00',a)); a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(COALESCE(TIMESTAMP'2001-01-01 00:00:00.0',a))<=>LENGTH(COALESCE(TIMESTAMP'2001-01-01 00:00:00.00',a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where octet_length(coalesce(TIMESTAMP'2001-01-01 00:00:00.0',`test`.`t1`.`a`)) <=> octet_length(coalesce(TIMESTAMP'2001-01-01 00:00:00.00',`test`.`t1`.`a`)) EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE LENGTH(COALESCE(TIME''00:00:00.0'',a))<=>LENGTH(COALESCE(?,a))' USING TIMESTAMP'2001-01-01 00:00:00.00'; a EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(COALESCE(TIME''00:00:00.0'',a))<=>LENGTH(COALESCE(?,a))' USING TIMESTAMP'2001-01-01 00:00:00.00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where octet_length(coalesce(TIME'00:00:00.0',`test`.`t1`.`a`)) <=> octet_length(coalesce(<cache>(TIMESTAMP'2001-01-01 00:00:00.00'),`test`.`t1`.`a`)) DROP TABLE t1; diff --git a/mysql-test/main/type_datetime_round.result b/mysql-test/main/type_datetime_round.result index c6584223268..625d97ed73e 100644 --- a/mysql-test/main/type_datetime_round.result +++ b/mysql-test/main/type_datetime_round.result @@ -152,15 +152,15 @@ a Warnings: Note 1292 Truncated incorrect datetime value: '20010101235959.9999999' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='20010101235959.9999999' AND a>='20010101235959.9999999'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1292 Truncated incorrect datetime value: '20010101235959.9999999' Note 1292 Truncated incorrect datetime value: '20010101235959.9999999' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-02 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='20010101235959.9999999' AND CONCAT(a)='2001-01-02 00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1292 Truncated incorrect datetime value: '20010101235959.9999999' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-02 00:00:00' diff --git a/mysql-test/main/type_decimal.result b/mysql-test/main/type_decimal.result index 7bf3b52970a..24c1796bcf3 100644 --- a/mysql-test/main/type_decimal.result +++ b/mysql-test/main/type_decimal.result @@ -1225,44 +1225,44 @@ CREATE TABLE t1 (a DECIMAL(10,1)); INSERT INTO t1 VALUES (1),(2),(3); # Equal values EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1.0+a<=>1.0+a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING 1.0,1.0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1.0+a<=>?+a' USING 1.0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>1.0+a' USING 1.0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 # Not equal values EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1.0+a<=>1.1+a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1.0 + `test`.`t1`.`a` <=> 1.1 + `test`.`t1`.`a` EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING 1.0,1.1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1.0 + `test`.`t1`.`a` <=> 1.1 + `test`.`t1`.`a` EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1.0+a<=>?+a' USING 1.1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1.0 + `test`.`t1`.`a` <=> 1.1 + `test`.`t1`.`a` EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>1.0+a' USING 1.1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1.1 + `test`.`t1`.`a` <=> 1.0 + `test`.`t1`.`a` DROP TABLE t1; @@ -1277,8 +1277,8 @@ a 10.000 10.100 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(10.0)+a<=>LENGTH(10.0)+a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE LENGTH(10.0)+a<=>LENGTH(?)+a' USING 10.0; @@ -1286,23 +1286,23 @@ a 10.000 10.100 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(10.0)+a<=>LENGTH(?)+a' USING 10.0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 Values with different formats SELECT * FROM t1 WHERE LENGTH(10.0)+a<=>LENGTH(10.00)+a; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(10.0)+a<=>LENGTH(10.00)+a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <cache>(octet_length(10.0)) + `test`.`t1`.`a` <=> <cache>(octet_length(10.00)) + `test`.`t1`.`a` EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE LENGTH(10.0)+a<=>LENGTH(?)+a' USING 10.00; a EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(10.0)+a<=>LENGTH(?)+a' USING 10.00; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <cache>(octet_length(10.0)) + `test`.`t1`.`a` <=> <cache>(octet_length(10.00)) + `test`.`t1`.`a` DROP TABLE t1; diff --git a/mysql-test/main/type_float.result b/mysql-test/main/type_float.result index 5137a8229b6..486ddab3c24 100644 --- a/mysql-test/main/type_float.result +++ b/mysql-test/main/type_float.result @@ -276,8 +276,8 @@ insert into t1 values (3, -4986.24), (3, 5.00), (3, 4857.34), (3, 123.74), (3, 0.16), (6, -1695.31), (6, 1003.77), (6, 499.72), (6, 191.82); explain select sum(b) s from t1 group by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 26 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 26 Using temporary; Using filesort select sum(b) s from t1 group by a; s 0.00 @@ -308,8 +308,8 @@ s 0.00 alter table t1 add key (a, b); explain select sum(b) s from t1 group by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL a 14 NULL 26 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL a 14 NULL 26 Using index select sum(b) s from t1 group by a; s 0.00 @@ -535,9 +535,9 @@ a 1999-01-01 00:00:00 # t2 should NOT be eliminated EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 index PRIMARY PRIMARY 8 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL index PRIMARY PRIMARY 8 NULL 2 Using where; Using index DROP TABLE t1,t2; # # MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns @@ -565,9 +565,9 @@ a 10:20:30.000000 # t2 should NOT be elimitated EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 index PRIMARY PRIMARY 8 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL index PRIMARY PRIMARY 8 NULL 2 Using where; Using index DROP TABLE t1,t2; # # End of 10.0 tests @@ -593,14 +593,14 @@ a 100 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=6 AND a=100e0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 100e0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=100e0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 100e0 and <cache>(octet_length(100)) <> rand() DROP TABLE t1; @@ -612,15 +612,15 @@ SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10e0; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10e0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 # Notice 1.1 instead of 1.10 in the final WHERE condition EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10e0 and <cache>(octet_length(1.1)) <> rand() DROP TABLE t1; @@ -632,15 +632,15 @@ SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10e0; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10e0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 # Notice 1.10 in the final WHERE condition EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10e0 and <cache>(octet_length(1.10)) <> rand() DROP TABLE t1; @@ -652,15 +652,15 @@ SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10e0; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10e0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 # Notice 1.100 rather than 1.10 in the final WHERE condition EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10e0 and <cache>(octet_length(1.100)) <> rand() DROP TABLE t1; @@ -670,8 +670,8 @@ DROP TABLE t1; CREATE TABLE t1 (a DOUBLE ZEROFILL); INSERT INTO t1 VALUES (2010),(2020); EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010e0 AND a>=2010e0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010e0 DROP TABLE t1; @@ -921,8 +921,8 @@ a DROP TABLE t1; SET sql_mode=DEFAULT; EXPLAIN EXTENDED SELECT CAST(0.671437 AS FLOAT); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select cast(0.671437 as float) AS `CAST(0.671437 AS FLOAT)` CREATE TABLE t1 AS SELECT CAST(0.671437 AS FLOAT) AS c1; @@ -969,23 +969,23 @@ DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); INSERT INTO t1 VALUES (1),(2),(3); EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1e0+a<=>1e0+a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING 1e0,1e0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>1e0+a' USING 1e0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1e0+a<=>?+a' USING 1e0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 DROP TABLE t1; diff --git a/mysql-test/main/type_hex_hybrid.result b/mysql-test/main/type_hex_hybrid.result index afe338a1cd8..3e7402da485 100644 --- a/mysql-test/main/type_hex_hybrid.result +++ b/mysql-test/main/type_hex_hybrid.result @@ -14,8 +14,8 @@ utf8mb3 binary 17.100 16.100 SELECT * FROM t1 WHERE LENGTH(CHARSET('a'))+a<=>LENGTH(CHARSET(0x61))+a; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(CHARSET('a'))+a<=>LENGTH(CHARSET(0x61))+a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <cache>(octet_length(charset('a'))) + `test`.`t1`.`a` <=> <cache>(octet_length(charset(0x61))) + `test`.`t1`.`a` DROP TABLE t1; diff --git a/mysql-test/main/type_int.result b/mysql-test/main/type_int.result index c9763a1453e..3642dc92057 100644 --- a/mysql-test/main/type_int.result +++ b/mysql-test/main/type_int.result @@ -44,8 +44,8 @@ CAST('\n2' AS INT) CREATE TABLE t1 (a INT ZEROFILL); INSERT INTO t1 VALUES (2010),(2020); EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=2010; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 DROP TABLE t1; @@ -65,8 +65,8 @@ a 0000000128 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=128 AND hex(a)='80'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 128 and hex(`test`.`t1`.`a`) = '80' DROP TABLE t1; @@ -297,23 +297,23 @@ DROP TABLE t1, t2; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3); EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1+a<=>1+a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING 1,1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>1+a' USING 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1+a<=>?+a' USING 1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 DROP TABLE t1; @@ -323,11 +323,11 @@ DROP TABLE t1; CREATE TABLE t1 (a TINYINT, KEY(a)); INSERT INTO t1 VALUES (1),(2),(3),(4),(5); EXPLAIN SELECT * FROM t1 WHERE a=200; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN SELECT * FROM t1 WHERE a<=>200; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t1; # # MDEV-8554 Expect "Impossible WHERE" for never true values like a!=a, a<a, a>a @@ -335,39 +335,39 @@ DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3); EXPLAIN SELECT * FROM t1 WHERE a!=a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT COUNT(*) FROM t1 WHERE a!=a; COUNT(*) 0 EXPLAIN SELECT * FROM t1 WHERE a>a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT COUNT(*) FROM t1 WHERE a>a; COUNT(*) 0 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a<a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT COUNT(*) FROM t1 WHERE a<a; COUNT(*) 0 ALTER TABLE t1 MODIFY a TINYINT NOT NULL; EXPLAIN SELECT COUNT(*) FROM t1 WHERE a!=a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT COUNT(*) FROM t1 WHERE a!=a; COUNT(*) 0 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a>a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT COUNT(*) FROM t1 WHERE a>a; COUNT(*) 0 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a<a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT COUNT(*) FROM t1 WHERE a<a; COUNT(*) 0 @@ -375,38 +375,38 @@ COUNT(*) # MDEV-8554 Modifing expression doesn't hit "Impossible WHERE" clause # EXPLAIN SELECT COUNT(*) FROM t1 WHERE not (a!=a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT COUNT(*) FROM t1 WHERE not (a!=a); COUNT(*) 3 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a>a-1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where SELECT COUNT(*) FROM t1 WHERE a>a-1; COUNT(*) 3 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a<a+1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where SELECT COUNT(*) FROM t1 WHERE a<a+1; COUNT(*) 3 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a-1<a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where SELECT COUNT(*) FROM t1 WHERE a-1<a; COUNT(*) 3 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a NOT LIKE a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where SELECT COUNT(*) FROM t1 WHERE a NOT LIKE a; COUNT(*) 0 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a XOR a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where SELECT COUNT(*) FROM t1 WHERE a XOR a; COUNT(*) 0 diff --git a/mysql-test/main/type_newdecimal.result b/mysql-test/main/type_newdecimal.result index c55938eebf1..ee38bc2a81e 100644 --- a/mysql-test/main/type_newdecimal.result +++ b/mysql-test/main/type_newdecimal.result @@ -2131,9 +2131,9 @@ a 1999-01-01 00:00:00 # t2 should NOT be eliminated EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 index PRIMARY PRIMARY 14 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL index PRIMARY PRIMARY 14 NULL 2 Using where; Using index DROP TABLE t1,t2; # # MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns @@ -2161,9 +2161,9 @@ a 10:20:30.000000 # t2 should NOT be eliminated EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 index PRIMARY PRIMARY 14 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL index PRIMARY PRIMARY 14 NULL 2 Using where; Using index DROP TABLE t1,t2; # # End of 10.0 tests @@ -2182,15 +2182,15 @@ SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 # Notice 1.1 instead of 1.10 in the final WHERE condition EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10 and <cache>(octet_length(1.1)) <> rand() DROP TABLE t1; @@ -2202,15 +2202,15 @@ SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 # Notice 1.10 in the final WHERE condition EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10 and <cache>(octet_length(1.10)) <> rand() DROP TABLE t1; @@ -2222,15 +2222,15 @@ SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 # Notice 1.100 rather than 1.10 in the final WHERE condition EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1.10 and <cache>(octet_length(1.100)) <> rand() DROP TABLE t1; @@ -2240,8 +2240,8 @@ DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(10,1) ZEROFILL); INSERT INTO t1 VALUES (2010),(2020); EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010.0 AND a>=2010.0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010.0 DROP TABLE t1; @@ -2251,8 +2251,8 @@ DROP TABLE t1; CREATE TABLE t1 (a DECIMAL, KEY(a)) ENGINE=MyISAM; INSERT INTO t1 VALUES (1),(2),(3),(4),(5); EXPLAIN SELECT * FROM t1 WHERE a='ax' ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 6 const 1 Using where; Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 6 const 1 Using where; Using index; Using filesort DROP TABLE t1; # # MDEV-8502 DECIMAL accepts out of range DEFAULT values diff --git a/mysql-test/main/type_time.result b/mysql-test/main/type_time.result index 40746345bdf..9f9de640f5e 100644 --- a/mysql-test/main/type_time.result +++ b/mysql-test/main/type_time.result @@ -413,15 +413,15 @@ Warnings: Warning 1292 Truncated incorrect time value: '00:00:00x' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00x'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect time value: '00:00:00x' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00x'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect time value: '00:00:00x' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and <cache>(octet_length(TIME'00:00:00')) = 30 + rand() @@ -438,14 +438,14 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and <cache>(octet_length(TIME'00:00:00')) = 30 + rand() DROP TABLE t1; @@ -461,14 +461,14 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.000000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.000000' and <cache>(octet_length(TIME'00:00:00')) = 30 + rand() DROP TABLE t1; @@ -481,14 +481,14 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000'; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.000000' and <cache>(octet_length(TIME'00:00:00.000000')) = 30 + rand() DROP TABLE t1; @@ -504,14 +504,14 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=' 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and <cache>(octet_length(TIME'00:00:00')) = 30 + rand() DROP TABLE t1; @@ -527,14 +527,14 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and <cache>(octet_length(TIME'00:00:00')) = 30 + rand() DROP TABLE t1; @@ -556,14 +556,14 @@ a 10:20:31 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' and <cache>(octet_length(TIME'10:20:31')) = 30 + rand() DROP TABLE t1; @@ -580,14 +580,14 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123'; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.123'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' and <cache>(octet_length(TIME'10:20:31')) = 30 + rand() DROP TABLE t1; @@ -606,14 +606,14 @@ a 10:20:31 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' and <cache>(octet_length(TIME'10:20:31')) = 30 + rand() DROP TABLE t1; @@ -629,14 +629,14 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123'; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.123'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' and <cache>(octet_length(TIME'10:20:31.123000')) = 30 + rand() DROP TABLE t1; @@ -653,14 +653,14 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123'; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.123'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123' and <cache>(octet_length(TIME'10:20:31')) = 30 + rand() DROP TABLE t1; @@ -679,14 +679,14 @@ a 10:20:31 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.000' and <cache>(octet_length(TIME'10:20:31')) = 30 + rand() DROP TABLE t1; @@ -702,14 +702,14 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123'; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.123'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123' and <cache>(octet_length(TIME'10:20:31.123000')) = 30 + rand() DROP TABLE t1; @@ -726,14 +726,14 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123'; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' and <cache>(octet_length(TIME'10:20:31')) = 30 + rand() DROP TABLE t1; @@ -752,14 +752,14 @@ a 10:20:31 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31' and <cache>(octet_length(TIME'10:20:31')) = 30 + rand() DROP TABLE t1; @@ -775,14 +775,14 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123'; a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:31.123000' and <cache>(octet_length(TIME'10:20:31.123000')) = 30 + rand() DROP TABLE t1; @@ -812,14 +812,14 @@ a 10:20:30 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=8; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:30' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=30+RAND(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:30' and <cache>(octet_length(TIME'10:20:30')) = 30 + rand() # Old mode, TIMESTAMP literal, non-zero YYYYMMDD, no propagation @@ -831,26 +831,26 @@ a 34:20:30 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=8; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-00-01 10:20:30' and octet_length(`test`.`t1`.`a`) = 8 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=30+RAND(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-00-01 10:20:30' and octet_length(`test`.`t1`.`a`) = 30 + rand() EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=TIMESTAMP'0000-01-00 10:20:30' AND LENGTH(a)=8; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-01-00 10:20:30' and octet_length(`test`.`t1`.`a`) = 8 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=TIMESTAMP'0001-00-00 10:20:30' AND LENGTH(a)=8; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0001-00-00 10:20:30' and octet_length(`test`.`t1`.`a`) = 8 # Old mode, TIMESTAMP-alike string literal, zero YYYYMMDD, Ok to propagate @@ -862,14 +862,14 @@ a 10:20:30 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=8; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:30' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=30+RAND(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'10:20:30' and <cache>(octet_length(TIME'10:20:30')) = 30 + rand() # Old mode, TIMESTAMP-alike literal, non-zero YYYYMMDD, no propagation @@ -881,14 +881,14 @@ a 34:20:30 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '0000-00-01 10:20:30' and octet_length(`test`.`t1`.`a`) = 8 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=30+RAND(); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '0000-00-01 10:20:30' and octet_length(`test`.`t1`.`a`) = 30 + rand() DROP TABLE t1; @@ -913,8 +913,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a>=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' DROP TABLE t1; @@ -926,20 +926,20 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and timestamp('2015-08-08',TIME'00:00:00' + rand()) <= TIMESTAMP'2015-08-30 00:00:00.1' EXPLAIN EXTENDED SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00.1'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.100000' and timestamp('2015-08-08',TIME'00:00:00' + rand()) <= TIMESTAMP'2015-08-30 00:00:00.1' DROP TABLE t1; @@ -951,20 +951,20 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE DATE(a)<=DATE'2015-08-30' AND a='00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00' and timestamp('2015-08-08',TIME'00:00:00' + rand()) <= DATE'2015-08-30' EXPLAIN EXTENDED SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00.1'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:00.100000' and timestamp('2015-08-08',TIME'00:00:00' + rand()) <= DATE'2015-08-30' DROP TABLE t1; @@ -975,8 +975,8 @@ SET timestamp=DEFAULT; CREATE TABLE t1 (a TIME); INSERT INTO t1 VALUES ('00:00:01'),('00:00:02'); EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:01' AND COALESCE(a)>=TIME'00:00:01'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = TIME'00:00:01' DROP TABLE t1; @@ -998,8 +998,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE('2015-09-11'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00:00:00' # TIME cast + DATE literal @@ -1008,8 +1008,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09-11'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00:00:00' # TIME literal + DATE cast @@ -1018,8 +1018,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09-11'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = TIME'00:00:00' # TIME literal + DATE literal @@ -1028,8 +1028,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE'2015-09-11'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = TIME'00:00:00' # TIME-alike string literal + DATE cast @@ -1038,8 +1038,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00:00:00' and coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00' # TIME-alike string literal + DATE literal @@ -1048,8 +1048,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00:00:00' and coalesce(`test`.`t1`.`a`) = DATE'2015-09-11' # TIME-alike integer literal + DATE cast @@ -1058,8 +1058,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 0 and coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00' # TIME-alike integer literal + DATE literal @@ -1068,8 +1068,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 0 and coalesce(`test`.`t1`.`a`) = DATE'2015-09-11' # DATE cast + TIME cast @@ -1078,8 +1078,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:00:00'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00' # DATE cast + TIME literal @@ -1088,8 +1088,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00' # DATE cast + TIME-alike string literal @@ -1098,8 +1098,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00' and coalesce(`test`.`t1`.`a`) = '00:00:00' # DATE cast + TIME-alike integer literal @@ -1108,8 +1108,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00' and coalesce(`test`.`t1`.`a`) = 0 # DATE literal + TIME cast @@ -1118,8 +1118,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00:00'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2015-09-11' # DATE literal + TIME literal @@ -1128,8 +1128,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME'00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2015-09-11' # DATE literal + TIME-alike string literal @@ -1138,8 +1138,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)='00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2015-09-11' and coalesce(`test`.`t1`.`a`) = '00:00:00' # DATE literal + TIME-alike integer literal @@ -1148,8 +1148,8 @@ a 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = DATE'2015-09-11' and coalesce(`test`.`t1`.`a`) = 0 DROP TABLE t1; @@ -1241,8 +1241,8 @@ SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8; a 34:20:30 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '0000-00-01 10:20:30' and octet_length(`test`.`t1`.`a`) = 8 SET @@optimizer_use_condition_selectivity=4; @@ -1250,8 +1250,8 @@ SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8; a 34:20:30 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '0000-00-01 10:20:30' and octet_length(`test`.`t1`.`a`) = 8 drop table t1; @@ -1373,8 +1373,8 @@ DROP FUNCTION f1; CREATE TABLE t1 (f TIME, KEY(f)); INSERT INTO t1 VALUES ('10:10:10'),('20:20:20'); EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '23:59:59'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range f f 4 NULL 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range f f 4 NULL 1 100.00 Using where; Using index Warnings: Warning 1292 Truncated incorrect time value: '1995.0000000' Note 1003 select `test`.`t1`.`f` AS `f` from `test`.`t1` where '00:00:00.000000' between `test`.`t1`.`f` and <cache>('23:59:59') @@ -1697,8 +1697,8 @@ INSERT INTO t1 VALUES ('23:00:02', 'no'); INSERT INTO t1 VALUES ('23:00:03', 'yes'); INSERT INTO t1 VALUES ('23:00:04', 'yes'); EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('23:00:01','23:00:02'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 4 NULL 4 Using index condition SELECT * FROM t1 WHERE a NOT IN ('23:00:01','23:00:02'); a filler 23:00:03 yes @@ -1736,8 +1736,8 @@ INSERT INTO t1 VALUES ('-23:00:02', 'no'); INSERT INTO t1 VALUES ('-23:00:03', 'yes'); INSERT INTO t1 VALUES ('-23:00:04', 'yes'); EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('-23:00:01','-23:00:02'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 4 NULL 4 Using index condition SELECT * FROM t1 WHERE a NOT IN ('-23:00:01','-23:00:02'); a filler -23:00:04 yes @@ -1775,8 +1775,8 @@ INSERT INTO t1 VALUES ('24:00:02', 'no'); INSERT INTO t1 VALUES ('24:00:03', 'yes'); INSERT INTO t1 VALUES ('24:00:04', 'yes'); EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('24:00:01','24:00:02'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 4 NULL 4 Using index condition SELECT * FROM t1 WHERE a NOT IN ('24:00:01','24:00:02'); a filler 24:00:03 yes @@ -1814,8 +1814,8 @@ INSERT INTO t1 VALUES ('-24:00:02', 'no'); INSERT INTO t1 VALUES ('-24:00:03', 'yes'); INSERT INTO t1 VALUES ('-24:00:04', 'yes'); EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('-24:00:01','-24:00:02'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 4 NULL 4 Using index condition SELECT * FROM t1 WHERE a NOT IN ('-24:00:01','-24:00:02'); a filler -24:00:04 yes @@ -1853,8 +1853,8 @@ INSERT INTO t1 VALUES ('838:00:02', 'no'); INSERT INTO t1 VALUES ('838:00:03', 'yes'); INSERT INTO t1 VALUES ('838:00:04', 'yes'); EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('838:00:01','838:00:02'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 4 NULL 4 Using index condition SELECT * FROM t1 WHERE a NOT IN ('838:00:01','838:00:02'); a filler 838:00:03 yes @@ -1892,8 +1892,8 @@ INSERT INTO t1 VALUES ('-838:00:02', 'no'); INSERT INTO t1 VALUES ('-838:00:03', 'yes'); INSERT INTO t1 VALUES ('-838:00:04', 'yes'); EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('-838:00:01','-838:00:02'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 4 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 4 NULL 4 Using index condition SELECT * FROM t1 WHERE a NOT IN ('-838:00:01','-838:00:02'); a filler -838:00:04 yes @@ -1931,8 +1931,8 @@ INSERT INTO t1 VALUES ('23:00:02.1', 'no'); INSERT INTO t1 VALUES ('23:00:03.1', 'yes'); INSERT INTO t1 VALUES ('23:00:04.1', 'yes'); EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('23:00:01.1','23:00:02.1'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 4 Using index condition SELECT * FROM t1 WHERE a NOT IN ('23:00:01.1','23:00:02.1'); a filler 23:00:03.1 yes @@ -1970,8 +1970,8 @@ INSERT INTO t1 VALUES ('-23:00:02.1', 'no'); INSERT INTO t1 VALUES ('-23:00:03.1', 'yes'); INSERT INTO t1 VALUES ('-23:00:04.1', 'yes'); EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('-23:00:01.1','-23:00:02.1'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 4 Using index condition SELECT * FROM t1 WHERE a NOT IN ('-23:00:01.1','-23:00:02.1'); a filler -23:00:04.1 yes @@ -2009,8 +2009,8 @@ INSERT INTO t1 VALUES ('838:00:02.1', 'no'); INSERT INTO t1 VALUES ('838:00:03.1', 'yes'); INSERT INTO t1 VALUES ('838:00:04.1', 'yes'); EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('838:00:01.1','838:00:02.1'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 4 Using index condition SELECT * FROM t1 WHERE a NOT IN ('838:00:01.1','838:00:02.1'); a filler 838:00:03.1 yes @@ -2048,8 +2048,8 @@ INSERT INTO t1 VALUES ('-838:00:02.1', 'no'); INSERT INTO t1 VALUES ('-838:00:03.1', 'yes'); INSERT INTO t1 VALUES ('-838:00:04.1', 'yes'); EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('-838:00:01.1','-838:00:02.1'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 5 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range a a 5 NULL 4 Using index condition SELECT * FROM t1 WHERE a NOT IN ('-838:00:01.1','-838:00:02.1'); a filler -838:00:04.1 yes @@ -2065,44 +2065,44 @@ CREATE TABLE t1 (a TIME); INSERT INTO t1 VALUES (1),(2),(3); # Equal values EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(TIME'10:20:30',a)<=>COALESCE(TIME'10:20:30',a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALESCE(?,a)' USING TIME'10:20:30',TIME'10:20:30'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(TIME''10:20:30'',a)<=>COALESCE(?,a)' USING TIME'10:20:30'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALESCE(TIME''10:20:30'',a)' USING TIME'10:20:30'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 # Not equal values EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(TIME'10:20:30',a)<=>COALESCE(TIME'10:20:31',a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(TIME'10:20:30',`test`.`t1`.`a`) <=> coalesce(TIME'10:20:31',`test`.`t1`.`a`) EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALESCE(?,a)' USING TIME'10:20:30',TIME'10:20:31'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(<cache>(TIME'10:20:30'),`test`.`t1`.`a`) <=> coalesce(<cache>(TIME'10:20:31'),`test`.`t1`.`a`) EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(TIME''10:20:30'',a)<=>COALESCE(?,a)' USING TIME'10:20:31'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(TIME'10:20:30',`test`.`t1`.`a`) <=> coalesce(<cache>(TIME'10:20:31'),`test`.`t1`.`a`) EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALESCE(TIME''10:20:30'',a)' USING TIME'10:20:31'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(<cache>(TIME'10:20:31'),`test`.`t1`.`a`) <=> coalesce(TIME'10:20:30',`test`.`t1`.`a`) DROP TABLE t1; @@ -2118,8 +2118,8 @@ a 00:00:01 00:00:02 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(COALESCE(TIME'00:00:00.0',a))<=>LENGTH(COALESCE(TIME'00:00:00.0',a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE LENGTH(COALESCE(TIME''00:00:00.0'',a))<=>LENGTH(COALESCE(?,a))' USING TIME'00:00:00.0'; @@ -2128,8 +2128,8 @@ a 00:00:01 00:00:02 EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(COALESCE(TIME''00:00:00.0'',a))<=>LENGTH(COALESCE(?,a))' USING TIME'00:00:00.0'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1 Values with different formats @@ -2141,15 +2141,15 @@ LENGTH(COALESCE(TIME'00:00:00.0',a)) LENGTH(COALESCE(TIME'00:00:00.00',a)) SELECT * FROM t1 WHERE LENGTH(COALESCE(TIME'00:00:00.0',a))<=>LENGTH(COALESCE(TIME'00:00:00.00',a)); a EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(COALESCE(TIME'00:00:00.0',a))<=>LENGTH(COALESCE(TIME'00:00:00.00',a)); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where octet_length(coalesce(TIME'00:00:00.0',`test`.`t1`.`a`)) <=> octet_length(coalesce(TIME'00:00:00.00',`test`.`t1`.`a`)) EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE LENGTH(COALESCE(TIME''00:00:00.0'',a))<=>LENGTH(COALESCE(?,a))' USING TIME'00:00:00.00'; a EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(COALESCE(TIME''00:00:00.0'',a))<=>LENGTH(COALESCE(?,a))' USING TIME'00:00:00.00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where octet_length(coalesce(TIME'00:00:00.0',`test`.`t1`.`a`)) <=> octet_length(coalesce(<cache>(TIME'00:00:00.00'),`test`.`t1`.`a`)) DROP TABLE t1; diff --git a/mysql-test/main/type_time_6065.result b/mysql-test/main/type_time_6065.result index 56de96870b6..d327268bebe 100644 --- a/mysql-test/main/type_time_6065.result +++ b/mysql-test/main/type_time_6065.result @@ -8,9 +8,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_time_key = col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -29,9 +29,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_datetime_key = col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM @@ -50,9 +50,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_time_key = col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where -1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +1 SIMPLE t2 NULL ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -71,9 +71,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_datetime_key = col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where -1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +1 SIMPLE t2 NULL ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM @@ -92,9 +92,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_time_key = col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -113,9 +113,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_datetime_key = col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM @@ -134,9 +134,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_time_key = col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using where; Using index -1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using where; Using index +1 SIMPLE t2 NULL ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -155,9 +155,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_datetime_key = col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using where; Using index -1 SIMPLE t2 ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using where; Using index +1 SIMPLE t2 NULL ref col_datetime_key col_datetime_key 6 test.t1.col_time_key 1 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM @@ -176,9 +176,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key = col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -197,9 +197,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key = col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM @@ -218,9 +218,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key = col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where -1 SIMPLE t1 ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +1 SIMPLE t1 NULL ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -239,9 +239,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key = col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where -1 SIMPLE t1 ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +1 SIMPLE t1 NULL ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM @@ -260,9 +260,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key = col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -281,9 +281,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key = col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM @@ -302,9 +302,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key = col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using where; Using index -1 SIMPLE t1 ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using where; Using index +1 SIMPLE t1 NULL ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -323,9 +323,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key = col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using where; Using index -1 SIMPLE t1 ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using where; Using index +1 SIMPLE t1 NULL ref col_time_key col_time_key 4 test.t2.col_datetime_key 2 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key` SELECT * FROM @@ -344,9 +344,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_time_key >= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -375,9 +375,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_datetime_key >= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM @@ -406,9 +406,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_time_key >= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -437,9 +437,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_datetime_key >= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM @@ -468,9 +468,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_time_key >= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -499,9 +499,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_datetime_key >= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM @@ -530,9 +530,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_time_key >= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -561,9 +561,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_datetime_key >= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM @@ -592,9 +592,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key >= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -623,9 +623,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key >= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM @@ -654,9 +654,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key >= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -685,9 +685,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key >= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM @@ -716,9 +716,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key >= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -747,9 +747,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key >= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM @@ -778,9 +778,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key >= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -809,9 +809,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key >= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key` SELECT * FROM @@ -840,9 +840,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_time_key > col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -866,9 +866,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_datetime_key > col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM @@ -892,9 +892,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_time_key > col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -918,9 +918,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_datetime_key > col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM @@ -944,9 +944,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_time_key > col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -970,9 +970,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_datetime_key > col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM @@ -996,9 +996,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_time_key > col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1022,9 +1022,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_datetime_key > col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM @@ -1048,9 +1048,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key > col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1074,9 +1074,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key > col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM @@ -1100,9 +1100,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key > col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1126,9 +1126,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key > col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM @@ -1152,9 +1152,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key > col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1178,9 +1178,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key > col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM @@ -1204,9 +1204,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key > col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1230,9 +1230,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key > col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key` SELECT * FROM @@ -1256,9 +1256,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_time_key <= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1287,9 +1287,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_datetime_key <= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM @@ -1318,9 +1318,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_time_key <= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1349,9 +1349,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_datetime_key <= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM @@ -1380,9 +1380,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_time_key <= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1411,9 +1411,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_datetime_key <= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM @@ -1442,9 +1442,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_time_key <= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1473,9 +1473,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_datetime_key <= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM @@ -1504,9 +1504,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key <= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1535,9 +1535,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key <= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM @@ -1566,9 +1566,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key <= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1597,9 +1597,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key <= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM @@ -1628,9 +1628,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key <= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1659,9 +1659,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key <= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM @@ -1690,9 +1690,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key <= col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1721,9 +1721,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key <= col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key` SELECT * FROM @@ -1752,9 +1752,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_time_key < col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1778,9 +1778,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_datetime_key < col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM @@ -1804,9 +1804,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_time_key < col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1830,9 +1830,9 @@ t1 ignore INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_datetime_key < col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM @@ -1856,9 +1856,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_time_key < col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1882,9 +1882,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 ignore INDEX (col_datetime_key) WHERE col_datetime_key < col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM @@ -1908,9 +1908,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_time_key < col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1934,9 +1934,9 @@ t1 force INDEX (col_time_key) STRAIGHT_JOIN t2 force INDEX (col_datetime_key) WHERE col_datetime_key < col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index col_time_key col_time_key 4 NULL 5 100.00 Using index -1 SIMPLE t2 ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index col_time_key col_time_key 4 NULL 5 100.00 Using index +1 SIMPLE t2 NULL ALL col_datetime_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM @@ -1960,9 +1960,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key < col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -1986,9 +1986,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key < col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM @@ -2012,9 +2012,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key < col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -2038,9 +2038,9 @@ t2 ignore INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key < col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM @@ -2064,9 +2064,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_time_key < col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -2090,9 +2090,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 ignore INDEX (col_time_key) WHERE col_datetime_key < col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM @@ -2116,9 +2116,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_time_key < col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key` SELECT * FROM @@ -2142,9 +2142,9 @@ t2 force INDEX (col_datetime_key) STRAIGHT_JOIN t1 force INDEX (col_time_key) WHERE col_datetime_key < col_time_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index -1 SIMPLE t1 ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_datetime_key col_datetime_key 6 NULL 5 100.00 Using index +1 SIMPLE t1 NULL ALL col_time_key NULL NULL NULL 5 100.00 Range checked for each record (index map: 0x1) Warnings: Note 1003 select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where `test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key` SELECT * FROM @@ -2194,9 +2194,9 @@ INSERT INTO t3 VALUES ('21:22:34'), ('10:50:38'), ('00:21:38'), ('02:59:24'), ('00:01:58'); EXPLAIN EXTENDED SELECT * FROM t2 STRAIGHT_JOIN t3 FORCE INDEX (col_time_key) ON t3.col_time_key > t2.col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system col_datetime_key NULL NULL NULL 1 100.00 -1 SIMPLE t3 index col_time_key col_time_key 4 NULL 20 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system col_datetime_key NULL NULL NULL 1 100.00 +1 SIMPLE t3 NULL index col_time_key col_time_key 4 NULL 20 100.00 Using where; Using index Warnings: Note 1003 select 1 AS `col_int_nokey`,'2001-11-04 19:07:55' AS `col_datetime_key`,'k' AS `col_varchar_key`,`test`.`t3`.`col_time_key` AS `col_time_key` from `test`.`t3` FORCE INDEX (`col_time_key`) where `test`.`t3`.`col_time_key` > '2001-11-04 19:07:55' SELECT * FROM t2 STRAIGHT_JOIN t3 FORCE INDEX (col_time_key) @@ -2224,9 +2224,9 @@ col_int_nokey col_datetime_key col_varchar_key col_time_key 1 2001-11-04 19:07:55 k 21:22:34 EXPLAIN EXTENDED SELECT * FROM t2 STRAIGHT_JOIN t3 IGNORE INDEX (col_time_key) ON t3.col_time_key > t2.col_datetime_key; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 system col_datetime_key NULL NULL NULL 1 100.00 -1 SIMPLE t3 ALL NULL NULL NULL NULL 20 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system col_datetime_key NULL NULL NULL 1 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 20 100.00 Using where Warnings: Note 1003 select 1 AS `col_int_nokey`,'2001-11-04 19:07:55' AS `col_datetime_key`,'k' AS `col_varchar_key`,`test`.`t3`.`col_time_key` AS `col_time_key` from `test`.`t3` IGNORE INDEX (`col_time_key`) where `test`.`t3`.`col_time_key` > '2001-11-04 19:07:55' SELECT * FROM t2 STRAIGHT_JOIN t3 IGNORE INDEX (col_time_key) @@ -2265,11 +2265,11 @@ outr.col_int_nokey <= 6 OR outr.col_varchar_key IS NULL ); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY outr system col_datetime_key NULL NULL NULL 1 100.00 -1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00 -1 PRIMARY outr2 index col_time_key col_time_key 4 NULL 20 100.00 Using where; Using index; Using join buffer (flat, BNL join) -2 MATERIALIZED innr ref col_int_key col_int_key 4 const 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY outr NULL system col_datetime_key NULL NULL NULL 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY outr2 NULL index col_time_key col_time_key 4 NULL 20 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 MATERIALIZED innr NULL ref col_int_key col_int_key 4 const 2 100.00 Using where Warnings: Note 1003 select 1 AS `col_int_nokey` from `test`.`t3` `outr2` semi join (`test`.`t1` `innr`) where `test`.`innr`.`col_int_key` = 1 and `test`.`innr`.`pk` >= `test`.`innr`.`col_int_nokey` and `test`.`outr2`.`col_time_key` > '2001-11-04 19:07:55' SELECT outr.col_int_nokey diff --git a/mysql-test/main/type_time_round.result b/mysql-test/main/type_time_round.result index 31e97c888db..67e21a7daf0 100644 --- a/mysql-test/main/type_time_round.result +++ b/mysql-test/main/type_time_round.result @@ -205,15 +205,15 @@ a Warnings: Note 1292 Truncated incorrect time value: '0.9999999' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0.9999999' AND a>='0.9999999'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1292 Truncated incorrect time value: '0.9999999' Note 1292 Truncated incorrect time value: '0.9999999' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:01' EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0.9999999' AND CONCAT(a)='00:00:01.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1292 Truncated incorrect time value: '0.9999999' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:01' diff --git a/mysql-test/main/type_timestamp.result b/mysql-test/main/type_timestamp.result index 52d0be675e2..1c1fb6ade90 100644 --- a/mysql-test/main/type_timestamp.result +++ b/mysql-test/main/type_timestamp.result @@ -568,8 +568,8 @@ a 2010-02-01 09:31:02 EXPLAIN SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0'; -id select_type table type possible_keys key key_len ref rows Extra -x x x range x x x x x x +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x range x x x x x x SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0'; a 2010-02-01 09:31:02 @@ -593,8 +593,8 @@ INSERT INTO t2 VALUES( '2010-02-01 09:31:11' ); FLUSH STATUS; EXPLAIN SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0'; -id select_type table type possible_keys key key_len ref rows Extra -x x x range x x x x x x +id select_type table partitions type possible_keys key key_len ref rows Extra +x x x x range x x x x x x SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0'; a 2010-02-01 09:31:01 @@ -845,15 +845,15 @@ Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a) != 20 AND a='2001-01-01 00:00:00x'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=30+RAND() AND a='2001-01-01 00:00:00x'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and <cache>(octet_length(TIMESTAMP'2001-01-01 00:00:00')) <> 30 + rand() @@ -869,20 +869,20 @@ a 2001-01-01 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=19+RAND() AND a=' 2001-01-01 00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and <cache>(octet_length(TIMESTAMP'2001-01-01 00:00:00')) = 19 + rand() EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' garbage '; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Incorrect datetime value: ' garbage ' Warning 1292 Incorrect datetime value: ' garbage ' @@ -902,14 +902,14 @@ a 2001-01-01 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' and <cache>(octet_length(TIMESTAMP'2001-01-01 00:00:00')) = 30 + rand() DROP TABLE t1; @@ -927,14 +927,14 @@ a 2001-01-01 00:00:00.000000 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=26 AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIMESTAMP'2001-01-01 00:00:00.000000'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00.000000' and <cache>(octet_length(TIMESTAMP'2001-01-01 00:00:00.000000')) = 40 + rand() DROP TABLE t1; @@ -953,14 +953,14 @@ a 2001-01-01 00:00:00 EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIME'00:00:00'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00' and <cache>(octet_length(TIMESTAMP'2001-01-01 00:00:00')) = 40 + rand() DROP TABLE t1; @@ -986,13 +986,13 @@ INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); EXPLAIN SELECT * FROM t1 WHERE a >= DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Warning 1441 Datetime function: datetime field overflow EXPLAIN SELECT * FROM t1 WHERE a >= COALESCE(DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR)); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Warning 1441 Datetime function: datetime field overflow DROP TABLE t1; diff --git a/mysql-test/main/type_timestamp.test b/mysql-test/main/type_timestamp.test index 80bc0bd0332..670cbc31493 100644 --- a/mysql-test/main/type_timestamp.test +++ b/mysql-test/main/type_timestamp.test @@ -381,7 +381,7 @@ SELECT * FROM t1 WHERE '2010-02-01 09:31:02.0' <= a; SELECT * FROM t1 WHERE a <= '2010-02-01 09:31:02.0'; SELECT * FROM t1 WHERE '2010-02-01 09:31:02.0' >= a; ---replace_column 1 x 2 x 3 x 5 x 6 x 7 x 8 x 9 x 10 x +--replace_column 1 x 2 x 3 x 4 x 6 x 7 x 8 x 9 x 10 x 11 x EXPLAIN SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0'; SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0'; @@ -404,7 +404,7 @@ INSERT INTO t2 VALUES( '2010-02-01 09:31:11' ); --echo # interval here. This reveals itself only in the number of reads --echo # performed. FLUSH STATUS; ---replace_column 1 x 2 x 3 x 5 x 6 x 7 x 8 x 9 x 10 x +--replace_column 1 x 2 x 3 x 4 x 6 x 7 x 8 x 9 x 10 x 11 x EXPLAIN SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0'; SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0'; diff --git a/mysql-test/main/type_uint.result b/mysql-test/main/type_uint.result index ef7a7ed98ca..cbdbdc924d6 100644 --- a/mysql-test/main/type_uint.result +++ b/mysql-test/main/type_uint.result @@ -63,9 +63,9 @@ a 1999-01-01 # t2 should NOT be eliminated EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL index PRIMARY PRIMARY 4 NULL 2 Using where; Using index DROP TABLE t1,t2; # # End of 10.0 tests diff --git a/mysql-test/main/type_varchar.result b/mysql-test/main/type_varchar.result index cfc8218b8ab..dca679e5bf5 100644 --- a/mysql-test/main/type_varchar.result +++ b/mysql-test/main/type_varchar.result @@ -101,14 +101,14 @@ Short string Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 257 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 257 const 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 257 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 257 NULL 3 Using where; Using index alter table t1 change v v varchar(255); select * from t1 where v like 'This is a test' order by v; v @@ -125,14 +125,14 @@ Short string Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 258 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 258 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 258 const 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 258 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 258 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 258 NULL 3 Using where; Using index alter table t1 change v v varchar(256); select * from t1 where v like 'This is a test' order by v; v @@ -149,14 +149,14 @@ Short string Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 259 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 259 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 259 const 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 259 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 259 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 259 NULL 3 Using where; Using index alter table t1 change v v varchar(257); select * from t1 where v like 'This is a test' order by v; v @@ -173,14 +173,14 @@ Short string Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 260 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 260 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 260 const 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 260 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 260 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 260 NULL 3 Using where; Using index alter table t1 change v v varchar(258); select * from t1 where v like 'This is a test' order by v; v @@ -197,14 +197,14 @@ Short string Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 261 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 261 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 261 const 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 261 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 261 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 261 NULL 3 Using where; Using index alter table t1 change v v varchar(259); select * from t1 where v like 'This is a test' order by v; v @@ -221,14 +221,14 @@ Short string Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 262 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 262 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 262 const 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 262 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 262 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 262 NULL 3 Using where; Using index alter table t1 change v v varchar(258); select * from t1 where v like 'This is a test' order by v; v @@ -245,14 +245,14 @@ Short string Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 261 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 261 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 261 const 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 261 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 261 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 261 NULL 3 Using where; Using index alter table t1 change v v varchar(257); select * from t1 where v like 'This is a test' order by v; v @@ -269,14 +269,14 @@ Short string Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 260 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 260 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 260 const 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 260 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 260 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 260 NULL 3 Using where; Using index alter table t1 change v v varchar(256); select * from t1 where v like 'This is a test' order by v; v @@ -293,14 +293,14 @@ Short string Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 259 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 259 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 259 const 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 259 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 259 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 259 NULL 3 Using where; Using index alter table t1 change v v varchar(255); select * from t1 where v like 'This is a test' order by v; v @@ -317,14 +317,14 @@ Short string Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 258 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 258 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 258 const 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 258 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 258 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 258 NULL 3 Using where; Using index alter table t1 change v v varchar(254); select * from t1 where v like 'This is a test' order by v; v @@ -341,14 +341,14 @@ Short string Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 257 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 257 const 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 257 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 257 NULL 3 Using where; Using index alter table t1 change v v varchar(253); alter table t1 change v v varchar(254), drop key v; alter table t1 change v v varchar(300), add key (v(10)); @@ -367,14 +367,14 @@ Short string Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 13 NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 13 NULL 4 Using where; Using filesort explain select * from t1 where v='This is a test' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref v v 13 const 4 Using where explain select * from t1 where v like 'S%' order by v; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 13 NULL 3 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range v v 13 NULL 3 Using where; Using filesort drop table t1; create table t1 (pkcol varchar(16), othercol varchar(16), primary key (pkcol)); insert into t1 values ('test', 'something'); @@ -610,18 +610,18 @@ c1 2001-01-01 2001-01-01 EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 -1 SIMPLE t2 index PRIMARY PRIMARY 22 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 +1 SIMPLE t2 NULL index PRIMARY PRIMARY 22 NULL 2 Using where; Using index SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; c1 2001-01-01 2001-01-01 # t2 should NOT be eliminated EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 index PRIMARY PRIMARY 22 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL index PRIMARY PRIMARY 22 NULL 2 Using where; Using index DROP TABLE IF EXISTS t1,t2; # # MDEV-6989 BINARY and COLLATE xxx_bin comparisions are not used for optimization in some cases @@ -632,14 +632,14 @@ SELECT * FROM t1 WHERE c1=BINARY 'a'; c1 a EXPLAIN SELECT * FROM t1 WHERE c1=BINARY 'a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 22 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 22 const 1 Using index SELECT * FROM t1 WHERE c1=_latin1'a' COLLATE latin1_bin; c1 a EXPLAIN SELECT * FROM t1 WHERE c1=_latin1'a' COLLATE latin1_bin; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 const PRIMARY PRIMARY 22 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 22 const 1 Using index DROP TABLE t1; CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin); INSERT INTO t1 VALUES ('a'); @@ -649,17 +649,17 @@ SELECT * FROM t1, t2 WHERE t1.c1=t2.c1; c1 c1 a a EXPLAIN SELECT * FROM t1, t2 WHERE t1.c1=t2.c1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 const PRIMARY PRIMARY 12 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL const PRIMARY PRIMARY 12 const 1 Using index ALTER TABLE t1 MODIFY c1 VARBINARY(10); SELECT * FROM t1, t2 WHERE t1.c1=t2.c1; c1 c1 a a EXPLAIN SELECT * FROM t1, t2 WHERE t1.c1=t2.c1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 -1 SIMPLE t2 const PRIMARY PRIMARY 12 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +1 SIMPLE t2 NULL const PRIMARY PRIMARY 12 const 1 Using index DROP TABLE t1, t2; CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin); INSERT INTO t1 VALUES ('a'),('c'); @@ -671,8 +671,8 @@ a c # t2 should be eliminated EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 ALTER TABLE t1 MODIFY c1 VARBINARY(10); SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); c1 @@ -680,8 +680,8 @@ a c # t2 should be eliminated EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 DROP TABLE t1,t2; # # End of 10.0 tests diff --git a/mysql-test/main/type_year.result b/mysql-test/main/type_year.result index a3918580e1f..118bef29b6b 100644 --- a/mysql-test/main/type_year.result +++ b/mysql-test/main/type_year.result @@ -422,32 +422,32 @@ SELECT * FROM t1 WHERE a=2010 AND a>=2010; a 2010 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=2010; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 SELECT * FROM t1 WHERE a=2010 AND a>=10; a 2010 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 SELECT * FROM t1 WHERE a=10 AND a>=2010; a 2010 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND a>=2010; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 SELECT * FROM t1 WHERE a=10 AND a>=10; a 2010 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND a>=10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010 DROP TABLE t1; @@ -581,8 +581,8 @@ SELECT * FROM t1 WHERE a=1993 and a=93; a 1993 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1993 and a=93; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1993 DROP TABLE t1; @@ -598,8 +598,8 @@ SELECT * FROM t1 WHERE a=1993 and a=93; a 93 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1993 and a=93; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 93 DROP TABLE t1; diff --git a/mysql-test/main/udf.result b/mysql-test/main/udf.result index 27bd17e7e31..842c0b8b507 100644 --- a/mysql-test/main/udf.result +++ b/mysql-test/main/udf.result @@ -100,8 +100,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp create table t1(f1 int); insert into t1 values(1),(2); explain select myfunc_int(f1) from t1 order by 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort drop table t1; CREATE TABLE t1(a INT, b INT); INSERT INTO t1 values (1,1),(2,2); @@ -116,13 +116,13 @@ myfunc_int(a AS attr_name) 1 2 EXPLAIN EXTENDED SELECT myfunc_int(a AS attr_name) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 select myfunc_int(`test`.`t1`.`a` AS `attr_name`) AS `myfunc_int(a AS attr_name)` from `test`.`t1` EXPLAIN EXTENDED SELECT myfunc_int(a) FROM t1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1003 select myfunc_int(`test`.`t1`.`a` AS `a`) AS `myfunc_int(a)` from `test`.`t1` SELECT a,c FROM v1; @@ -144,23 +144,23 @@ c 1 2 EXPLAIN EXTENDED SELECT myfunc_int(MIN(b) xx) as c FROM t1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort Warnings: Note 1003 select myfunc_int(min(`test`.`t1`.`b`) AS `xx`) AS `c` from `test`.`t1` group by `test`.`t1`.`a` EXPLAIN EXTENDED SELECT test.fn(MIN(b)) as c FROM t1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort Warnings: Note 1003 select `test`.`fn`(min(`test`.`t1`.`b`)) AS `c` from `test`.`t1` group by `test`.`t1`.`a` EXPLAIN EXTENDED SELECT myfunc_int(fn(MIN(b))) as c FROM t1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort Warnings: Note 1003 select myfunc_int(`fn`(min(`test`.`t1`.`b`)) AS `fn(MIN(b))`) AS `c` from `test`.`t1` group by `test`.`t1`.`a` EXPLAIN EXTENDED SELECT myfunc_int(test.fn(MIN(b))) as c FROM t1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort Warnings: Note 1003 select myfunc_int(`test`.`fn`(min(`test`.`t1`.`b`)) AS `test.fn(MIN(b))`) AS `c` from `test`.`t1` group by `test`.`t1`.`a` SELECT myfunc_int(MIN(b) xx) as c FROM t1 GROUP BY a; @@ -437,8 +437,8 @@ CREATE TABLE t1 (f1 INT); INSERT INTO t1 VALUES(1),(50); CREATE FUNCTION myfunc_double RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE f1=1 + myfunc_double(1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select 1 AS `1` from `test`.`t1` where `test`.`t1`.`f1` = <cache>(1 + myfunc_double(1 AS `1`)) DROP FUNCTION myfunc_double; diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result index c0a45a2ac14..c425b16b3c8 100644 --- a/mysql-test/main/union.result +++ b/mysql-test/main/union.result @@ -83,10 +83,10 @@ a b (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b; ERROR 42000: Table 't1' from one of the SELECTs cannot be used in ORDER clause explain extended (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00 -2 UNION t2 ALL NULL NULL NULL NULL 4 100.00 Using filesort -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 +2 UNION t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using filesort +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 (/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` limit 2) union all (/* select#2 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`a` limit 1) order by `b` desc select count(*) from ( @@ -112,9 +112,9 @@ select found_rows(); found_rows() 8 explain select a,b from t1 union all select a,b from t2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 UNION t2 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 UNION t2 NULL ALL NULL NULL NULL NULL 4 explain select xx from t1 union select 1; ERROR 42S22: Unknown column 'xx' in 'field list' explain select a,b from t1 union select 1; @@ -503,10 +503,10 @@ select length(version()) > 1 as `*` UNION select 2; create table t1 (a int); insert into t1 values (0), (3), (1), (2); explain (select * from t1) union (select * from t1) order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 -2 UNION t1 ALL NULL NULL NULL NULL 4 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 +2 UNION t1 NULL ALL NULL NULL NULL NULL 4 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL Using filesort drop table t1; CREATE TABLE t1 ( id int(3) unsigned default '0') ENGINE=MyISAM; INSERT INTO t1 (id) VALUES("1"); @@ -539,10 +539,10 @@ create table t2 (a int not null primary key auto_increment, b int); insert into t1 (b) values (1),(2),(2),(3); insert into t2 (b) values (10),(11),(12),(13); explain extended (select * from t1 where a=1) union (select * from t2 where a=1); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 100.00 -2 UNION t2 const PRIMARY PRIMARY 4 const 1 100.00 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 UNION t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 (/* select#1 */ select 1 AS `a`,1 AS `b` from `test`.`t1` where 1) union (/* select#2 */ select 1 AS `a`,10 AS `b` from `test`.`t2` where 1) (select * from t1 where a=5) union (select * from t2 where a=1); @@ -563,17 +563,17 @@ a b set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity,@save_optimizer_switch=@@optimizer_switch; SET optimizer_switch='outer_join_with_cache=off',@@optimizer_use_condition_selectivity=4; explain (select * from t1 where a=1 and b=10) union (select straight_join t1.a,t2.a from t1,t2 where t1.a=t2.a); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 UNION t1 index PRIMARY PRIMARY 4 NULL 4 Using index -2 UNION t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 UNION t1 NULL index PRIMARY PRIMARY 4 NULL 4 Using index +2 UNION t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity,@@optimizer_switch=@save_optimizer_switch; explain (select * from t1 where a=1) union (select * from t1 where b=1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 -2 UNION t1 ref b b 5 const 1 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL const PRIMARY PRIMARY 4 const 1 +2 UNION t1 NULL ref b b 5 const 1 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL drop table t1,t2; create table t1 ( id int not null auto_increment, primary key (id) ,user_name text ); create table t2 ( id int not null auto_increment, primary key (id) ,group_name text ); @@ -1637,10 +1637,10 @@ SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 Const row not found -2 UNION t1 system NULL NULL NULL NULL 0 0.00 Const row not found -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNION t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 /* select#1 */ select NULL AS `a` from `test`.`t1` union /* select#2 */ select NULL AS `a` from `test`.`t1` order by `a` DROP TABLE t1; @@ -1703,10 +1703,10 @@ INSERT INTO t2 VALUES (1),(2); # Should not crash EXPLAIN EXTENDED SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY a + 12; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 UNION t1 ALL NULL NULL NULL NULL 2 100.00 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` union /* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` order by `a` + 12 # Should not crash @@ -1718,10 +1718,10 @@ a EXPLAIN EXTENDED SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 UNION t1 ALL NULL NULL NULL NULL 2 100.00 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` union /* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` order by (match `a` against ('+abc' in boolean mode)) # Should not crash @@ -1740,11 +1740,11 @@ a EXPLAIN EXTENDED SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY (SELECT a FROM t2 WHERE b = 12); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 UNION t1 ALL NULL NULL NULL NULL 2 100.00 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort -3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL Using filesort +3 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #-1 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` union /* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <expr_cache><`a`>((/* select#3 */ select `a` from `test`.`t2` where `test`.`t2`.`b` = 12)) @@ -2035,11 +2035,11 @@ DROP TABLE t1,t2; create table t1 (a int); insert t1 values (1),(2),(3),(1); explain select 1 from dual where exists (select max(a) from t1 group by a union select a+2 from t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 SUBQUERY t1 ALL NULL NULL NULL NULL 4 Using temporary -3 UNION t1 ALL NULL NULL NULL NULL 4 -NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 4 Using temporary +3 UNION t1 NULL ALL NULL NULL NULL NULL 4 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL drop table t1; # # MDEV-6868:MariaDB server crash ( select with union and order by @@ -2172,14 +2172,14 @@ union select userid from t2 where product_id = ( select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 ) ) as x from t1 where (t1.bug_id=45199); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 -2 SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 func 1 Using where -3 SUBQUERY t2 ref PRIMARY PRIMARY 4 const 4 Using index -4 UNION t2 ref PRIMARY PRIMARY 4 func 1 Using where; Using index -5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -6 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL system PRIMARY NULL NULL NULL 1 +2 SUBQUERY t4 NULL eq_ref PRIMARY PRIMARY 4 func 1 Using where +3 SUBQUERY t2 NULL ref PRIMARY PRIMARY 4 const 4 Using index +4 UNION t2 NULL ref PRIMARY PRIMARY 4 func 1 Using where; Using index +5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +6 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL select ( select login_name from t4 where userId = ( @@ -2196,9 +2196,9 @@ End of 5.5 tests # WL#1763 Avoid creating temporary table in UNION ALL # EXPLAIN SELECT 1 UNION ALL SELECT 1 LIMIT 1 OFFSET 1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used # Bug #17579498 CHANGES IN DATATYPE OF THE RESULT QUERY IN UNION. CREATE TABLE t1 (a TIME); CREATE TABLE t2 (b DATETIME); @@ -2316,9 +2316,9 @@ SELECT * FROM t1 WHERE i IN ( SELECT pk FROM t2 ) ) AS sq GROUP BY i HAVING i = 10; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 /* select#1 */ select 1 AS `1`,2 AS `2` union all /* select#2 */ select 1 AS `i`,count(0) AS `COUNT(*)` from `test`.`t2` where 0 group by 1 having 1 DROP TABLE t1,t2; @@ -2594,11 +2594,11 @@ intersect select * from t3 where a < 5 union all select * from t1 where a > 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 Using where -2 INTERSECT t3 ALL NULL NULL NULL NULL 7 100.00 Using where -3 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where -NULL UNIT RESULT <unit1,2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 INTERSECT t3 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +3 UNION t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +NULL UNIT RESULT <unit1,2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where `test`.`t2`.`a` < 5 intersect /* select#2 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where `test`.`t3`.`a` < 5 union all /* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 explain extended @@ -2607,11 +2607,11 @@ except select * from t3 where a < 5 union all select * from t1 where a > 4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 Using where -2 EXCEPT t3 ALL NULL NULL NULL NULL 7 100.00 Using where -3 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where -NULL UNIT RESULT <unit1,2,3> ALL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 EXCEPT t3 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +3 UNION t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using where +NULL UNIT RESULT <unit1,2,3> NULL ALL NULL NULL NULL NULL NULL NULL Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where `test`.`t2`.`a` < 5 except /* select#2 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where `test`.`t3`.`a` < 5 union all /* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 drop table t1,t2,t3; diff --git a/mysql-test/main/update.result b/mysql-test/main/update.result index f5edf1c6be3..41fc206e75e 100644 --- a/mysql-test/main/update.result +++ b/mysql-test/main/update.result @@ -704,8 +704,8 @@ select A.a + 10 * B.a + 100 * C.a, 1234 from t2 A, t2 B, t2 C; # This must not have "Using filesort": explain update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range key1 key1 5 NULL 2 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 2 Using where; Using buffer flush status; update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2; show status like 'Handler_read%'; diff --git a/mysql-test/main/update_use_source.result b/mysql-test/main/update_use_source.result index 2774e7ee92d..726b4c4ef6d 100644 --- a/mysql-test/main/update_use_source.result +++ b/mysql-test/main/update_use_source.result @@ -74,9 +74,9 @@ rollback; # Update via RANGE or INDEX access if an index or a primary key exists # explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where -2 DEPENDENT SUBQUERY a ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 Using where +2 DEPENDENT SUBQUERY a NULL ALL NULL NULL NULL NULL 8 Using where start transaction; update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; affected rows: 4 @@ -204,9 +204,9 @@ rollback; # start transaction; explain update t1 set c3=c3+10 where c2 in (select distinct a.c2 from t1 a where t1.c1=a.c1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 8 -1 PRIMARY a ALL NULL NULL NULL NULL 8 Using where; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 +1 PRIMARY a NULL ALL NULL NULL NULL NULL 8 Using where; FirstMatch(t1) update t1 set c3=c3+10 where c2 in (select distinct a.c2 from t1 a where t1.c1=a.c1); affected rows: 8 info: Rows matched: 8 Changed: 8 Warnings: 0 @@ -315,9 +315,9 @@ rollback; # Update via RANGE or INDEX access if an index or a primary key exists # explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range t1_c2 t1_c2 5 NULL 2 Using where -2 DEPENDENT SUBQUERY a ref t1_c2 t1_c2 5 test.t1.c2 4 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range t1_c2 t1_c2 5 NULL 2 Using where +2 DEPENDENT SUBQUERY a NULL ref t1_c2 t1_c2 5 test.t1.c2 4 Using index start transaction; update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; affected rows: 4 @@ -445,9 +445,9 @@ rollback; # start transaction; explain update t1 set c3=c3+10 where c2 in (select distinct a.c2 from t1 a where t1.c1=a.c1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL t1_c2 NULL NULL NULL 8 Using where -1 PRIMARY a ref t1_c2 t1_c2 10 test.t1.c2,test.t1.c1 1 Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL t1_c2 NULL NULL NULL 8 Using where +1 PRIMARY a NULL ref t1_c2 t1_c2 10 test.t1.c2,test.t1.c1 1 Using index; FirstMatch(t1) update t1 set c3=c3+10 where c2 in (select distinct a.c2 from t1 a where t1.c1=a.c1); affected rows: 8 info: Rows matched: 8 Changed: 8 Warnings: 0 @@ -556,9 +556,9 @@ rollback; # Update via RANGE or INDEX access if an index or a primary key exists # explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range t1_c2 t1_c2 5 NULL 2 Using where -2 DEPENDENT SUBQUERY a ref t1_c2 t1_c2 5 test.t1.c2 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range t1_c2 t1_c2 5 NULL 2 Using where +2 DEPENDENT SUBQUERY a NULL ref t1_c2 t1_c2 5 test.t1.c2 1 Using index start transaction; update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; affected rows: 4 @@ -686,9 +686,9 @@ rollback; # start transaction; explain update t1 set c3=c3+10 where c2 in (select distinct a.c2 from t1 a where t1.c1=a.c1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL t1_c2 NULL NULL NULL 8 Using where -1 PRIMARY a ref t1_c2 t1_c2 10 test.t1.c2,test.t1.c1 1 Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL t1_c2 NULL NULL NULL 8 Using where +1 PRIMARY a NULL ref t1_c2 t1_c2 10 test.t1.c2,test.t1.c1 1 Using index; FirstMatch(t1) update t1 set c3=c3+10 where c2 in (select distinct a.c2 from t1 a where t1.c1=a.c1); affected rows: 8 info: Rows matched: 8 Changed: 8 Warnings: 0 @@ -798,9 +798,9 @@ rollback; # Update via RANGE or INDEX access if an index or a primary key exists # explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range t1_c2 t1_c2 5 NULL 2 Using where -2 DEPENDENT SUBQUERY a ref t1_c2 t1_c2 5 test.t1.c2 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL range t1_c2 t1_c2 5 NULL 2 Using where +2 DEPENDENT SUBQUERY a NULL ref t1_c2 t1_c2 5 test.t1.c2 1 Using index start transaction; update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3; affected rows: 4 @@ -928,9 +928,9 @@ rollback; # start transaction; explain update t1 set c3=c3+10 where c2 in (select distinct a.c2 from t1 a where t1.c1=a.c1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL t1_c2 NULL NULL NULL 8 Using where -1 PRIMARY a ref t1_c2 t1_c2 10 test.t1.c2,test.t1.c1 1 Using index; FirstMatch(t1) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL t1_c2 NULL NULL NULL 8 Using where +1 PRIMARY a NULL ref t1_c2 t1_c2 10 test.t1.c2,test.t1.c1 1 Using index; FirstMatch(t1) update t1 set c3=c3+10 where c2 in (select distinct a.c2 from t1 a where t1.c1=a.c1); affected rows: 8 info: Rows matched: 8 Changed: 8 Warnings: 0 diff --git a/mysql-test/main/user_var.result b/mysql-test/main/user_var.result index de339b4b037..a6ebd7f1237 100644 --- a/mysql-test/main/user_var.result +++ b/mysql-test/main/user_var.result @@ -21,21 +21,21 @@ i @vv1:=if(sv1.i,1,0) @vv2:=if(sv2.i,1,0) @vv3:=if(sv3.i,1,0) @vv1+@vv2+@vv3 1 1 0 1 2 2 1 0 0 1 explain select * from t1 where i=@vv1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref i i 4 const 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref i i 4 const 2 select @vv1,i,v from t1 where i=@vv1; @vv1 i v 1 1 1 1 1 3 explain select * from t1 where @vv1:=@vv1+1 and i=@vv1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where explain select @vv1:=i from t1 where i=@vv1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL i 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL i 4 NULL 3 Using where; Using index explain select * from t1 where i=@vv1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref i i 4 const 2 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref i i 4 const 2 drop table t1,t2; set @a=0,@b=0; select @a:=10, @b:=1, @a > @b, @a < @b; @@ -371,8 +371,8 @@ create table t1(b bigint); insert into t1 (b) values (10), (30), (10), (10); set @var := 0; explain select if(b=@var, 999, b) , @var := b from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using temporary; Using filesort set @var := 0; select if(b=@var, 999, b) , @var := b from t1 order by b; if(b=@var, 999, b) @var := b @@ -575,8 +575,8 @@ End of 5.5 tests set @var= repeat('a',20000); 1 explain select @a:=max(seq) from seq_1_to_1000000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away # # Start of 10.3 tests # diff --git a/mysql-test/main/varbinary.result b/mysql-test/main/varbinary.result index 3a182e74692..a53fc63b6c8 100644 --- a/mysql-test/main/varbinary.result +++ b/mysql-test/main/varbinary.result @@ -37,8 +37,8 @@ SELECT CAST(x'312E39' AS DECIMAL(10,1)), CAST(0x312E39 AS DECIMAL(10,1)); CAST(x'312E39' AS DECIMAL(10,1)) CAST(0x312E39 AS DECIMAL(10,1)) 1.9 3223097.0 EXPLAIN EXTENDED SELECT X'FFFF', 0xFFFF; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select X'ffff' AS `X'FFFF'`,0xffff AS `0xFFFF` CREATE TABLE t1 (a int); @@ -65,8 +65,8 @@ create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint insert into t1 set UNIQ=0x38afba1d73e6a18a; insert into t1 set UNIQ=123; explain extended select * from t1 where UNIQ=0x38afba1d73e6a18a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 const UNIQ UNIQ 8 const 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const UNIQ UNIQ 8 const 1 100.00 Warnings: Note 1003 select 00000001 AS `ID`,004084688022709641610 AS `UNIQ` from `test`.`t1` where 1 drop table t1; diff --git a/mysql-test/main/variables.result b/mysql-test/main/variables.result index 49af27b8a5f..346ca4b44dc 100644 --- a/mysql-test/main/variables.result +++ b/mysql-test/main/variables.result @@ -75,8 +75,8 @@ select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3; @t1:=(@t2:=1)+@t3:=4 @t1 @t2 @t3 5 5 1 4 explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select @t1:=(@t2:=1) + (@t3:=4) AS `@t1:=(@t2:=1)+@t3:=4`,@`t1` AS `@t1`,@`t2` AS `@t2`,@`t3` AS `@t3` select @t5; @@ -150,16 +150,16 @@ select last_insert_id(345); last_insert_id(345) 345 explain extended select last_insert_id(345); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select last_insert_id(345) AS `last_insert_id(345)` select @@IDENTITY,last_insert_id(), @@identity; @@IDENTITY last_insert_id() @@identity 345 345 345 explain extended select @@IDENTITY,last_insert_id(), @@identity; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select @@IDENTITY AS `@@IDENTITY`,last_insert_id() AS `last_insert_id()`,@@identity AS `@@identity` set global concurrent_insert=2; @@ -1522,9 +1522,9 @@ SELECT 1 as 'one' FROM t1 GROUP BY @a:= ROUND(f1); one 1 explain SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0); one 1 @@ -1533,9 +1533,9 @@ one 1 set sql_buffer_result=1; explain SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary -2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 Using temporary +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 Using where SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0); one 1 @@ -1777,23 +1777,23 @@ VARIABLE_NAME VARIABLE_VALUE SQL_MODE ANSI_QUOTES End of 5.5 tests explain extended select @@VERsion from dual where rand() > @@verSION; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select @@VERsion AS "@@VERsion" from DUAL where rand() > @@version explain extended select @@SESsion.SQL_mode from dual where rand() > @@sesSION.sql_MODE; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select @@SESsion.SQL_mode AS "@@SESsion.SQL_mode" from DUAL where rand() > @@sql_mode explain extended select @@GLObal.COLLATION_connection from dual where rand() > @@gloBAL.collation_CONNECTION; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select @@GLObal.COLLATION_connection AS "@@GLObal.COLLATION_connection" from DUAL where rand() > @@global.collation_connection explain extended select @@FOObar.KEY_BUFfer_size from dual where rand() > @@fooBAR.key_bufFER_SIZE; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select @@FOObar.KEY_BUFfer_size AS "@@FOObar.KEY_BUFfer_size" from DUAL where rand() > @@fooBAR.key_buffer_size # diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index 27c091a71d1..4620f9dd825 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -51,8 +51,8 @@ ERROR 42S22: Unknown column 'b' in 'field list' select v1.b from v1; ERROR 42S22: Unknown column 'v1.b' in 'field list' explain extended select c from v1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1003 select `test`.`t1`.`b` + 1 AS `c` from `test`.`t1` create algorithm=temptable view v2 (c) as select b+1 from t1; @@ -67,9 +67,9 @@ c 6 11 explain extended select c from v2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1003 /* select#1 */ select `v2`.`c` AS `c` from `test`.`v2` create view v3 (c) as select a+1 from v1; @@ -85,8 +85,8 @@ c 7 12 explain extended select c from v3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1003 select `test`.`t1`.`b` + 1 + 1 AS `c` from `test`.`t1` create algorithm=temptable view v4 (c) as select c+1 from v2; @@ -98,10 +98,10 @@ c 7 12 explain extended select c from v4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 100.00 -2 DERIVED <derived3> ALL NULL NULL NULL NULL 5 100.00 -3 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 5 100.00 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1003 /* select#1 */ select `v4`.`c` AS `c` from `test`.`v4` create view v5 (c) as select c+1 from v2; @@ -113,9 +113,9 @@ c 7 12 explain extended select c from v5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 100.00 -3 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 5 100.00 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1003 /* select#1 */ select `v2`.`c` + 1 AS `c` from `test`.`v2` create algorithm=temptable view v6 (c) as select c+1 from v1; @@ -127,9 +127,9 @@ c 7 12 explain extended select c from v6; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 100.00 -2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Warnings: Note 1003 /* select#1 */ select `v6`.`c` AS `c` from `test`.`v6` show tables; @@ -233,9 +233,9 @@ a 2 3 explain select * from v1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 -2 DERIVED t1 ALL NULL NULL NULL NULL 6 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 6 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 6 Using temporary select * from t1; a 1 @@ -298,9 +298,9 @@ a+1 5 4 explain select * from v1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 -2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 4 Using filesort drop view v1; drop table t1; create table t1 (a int); @@ -384,8 +384,8 @@ c 20 30 explain extended select * from v1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`b` AS `c` from `test`.`t1` where `test`.`t1`.`a` < 3 update v1 set c=c+1; @@ -1366,10 +1366,10 @@ a a b 2 2 NULL 4 NULL NULL explain extended select * from t3 left join v3 on (t3.a = v3.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t3`.`a`)) on(`test`.`t1`.`a` = `test`.`t3`.`a`) where 1 create view v1 (a) as select a from t1; @@ -1381,10 +1381,10 @@ a a b 2 2 NULL 4 NULL NULL explain extended select * from t3 left join v4 on (t3.a = v4.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join (`test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`)) on(`test`.`t1`.`a` = `test`.`t3`.`a`) where 1 prepare stmt1 from "select * from t3 left join v4 on (t3.a = v4.a);"; @@ -2311,17 +2311,17 @@ INSERT INTO t3 VALUES (1),(2),(3); CREATE VIEW v1 AS SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a AND t1.b=t2.b; CREATE VIEW v2 AS SELECT t3.* FROM t1,t3 WHERE t1.a=t3.a; EXPLAIN SELECT t1.* FROM t1 JOIN t2 WHERE t1.a=t2.a AND t1.b=t2.b AND t1.a=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using where; Using index -1 SIMPLE t2 ref a a 10 const,test.t1.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 5 const 1 Using where; Using index +1 SIMPLE t2 NULL ref a a 10 const,test.t1.b 1 Using index EXPLAIN SELECT * FROM v1 WHERE a=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using where; Using index -1 SIMPLE t2 ref a a 10 const,test.t1.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 5 const 1 Using where; Using index +1 SIMPLE t2 NULL ref a a 10 const,test.t1.b 1 Using index EXPLAIN SELECT * FROM v2 WHERE a=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 5 const 1 Using index -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ref a a 5 const 1 Using index +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) DROP VIEW v1,v2; DROP TABLE t1,t2,t3; create table t1 (f1 int); @@ -2407,8 +2407,8 @@ create table t1 (id INT, primary key(id)); insert into t1 values (1),(2); create view v1 as select * from t1; explain select id from v1 order by id; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 Using index drop view v1; drop table t1; create table t1(f1 int, f2 int); @@ -2477,11 +2477,11 @@ SELECT MAX(a) FROM v1; MAX(a) 5 EXPLAIN SELECT MAX(a) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away EXPLAIN SELECT MAX(a) FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away SELECT MIN(a) FROM t1; MIN(a) 0 @@ -2489,11 +2489,11 @@ SELECT MIN(a) FROM v1; MIN(a) 0 EXPLAIN SELECT MIN(a) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away EXPLAIN SELECT MIN(a) FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (x varchar(10)); @@ -2941,20 +2941,20 @@ DROP TABLE t1; CREATE TABLE t1 (s1 int); CREATE VIEW v1 AS SELECT * FROM t1; EXPLAIN SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found EXPLAIN SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found INSERT INTO t1 VALUES (1), (3), (2); EXPLAIN SELECT * FROM t1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t ALL NULL NULL NULL NULL 3 Using where -2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 3 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 EXPLAIN SELECT * FROM v1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 DROP VIEW v1; DROP TABLE t1; create table t1 (s1 int); @@ -3120,8 +3120,8 @@ f1 f2 1 3 2 3 explain extended select * from v1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using filesort Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2` from `test`.`t1` order by `test`.`t1`.`f2` select * from v1 order by f1; @@ -3133,8 +3133,8 @@ f1 f2 2 1 2 2 explain extended select * from v1 order by f1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 100.00 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using filesort Warnings: Note 1926 View 'test'.'v1' ORDER BY clause ignored because there is other ORDER BY clause already Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2` from `test`.`t1` order by `test`.`t1`.`f1` @@ -3339,30 +3339,30 @@ a 2 3 EXPLAIN SELECT * FROM t1 UNION SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -2 UNION t1 ALL NULL NULL NULL NULL 3 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +2 UNION t1 NULL ALL NULL NULL NULL NULL 3 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL SELECT * FROM v1 UNION SELECT * FROM t1; a 1 2 3 EXPLAIN SELECT * FROM v1 UNION SELECT * FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -2 UNION t1 ALL NULL NULL NULL NULL 3 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +2 UNION t1 NULL ALL NULL NULL NULL NULL 3 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL SELECT * FROM t1 UNION SELECT * FROM v1 ORDER BY a; a 1 2 3 EXPLAIN SELECT * FROM t1 UNION SELECT * FROM v1 ORDER BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 3 -2 UNION t1 ALL NULL NULL NULL NULL 3 -NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 +2 UNION t1 NULL ALL NULL NULL NULL NULL 3 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL Using filesort DROP VIEW v1; DROP TABLE t1; CREATE VIEW v1 AS SELECT CAST( 1.23456789 AS DECIMAL( 7,5 ) ) AS col; @@ -3473,21 +3473,21 @@ SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b; b SUM(a) 3 4 EXPLAIN SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a; a SUM(b) 1 6 2 3 EXPLAIN SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a; a SUM(b) 1 10 EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 ( @@ -3527,10 +3527,10 @@ INSERT INTO t3 VALUES (7,'SOC_USER','SOCCANS'),(8,'CAYIT_USER','CAYITCANS'), (9,'RTOS_DCFSPOS_SUPERVISOR','RTOS'); EXPLAIN SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE profile const PRIMARY PRIMARY 4 const 1 Using temporary; Using filesort -1 SIMPLE userrole ref idx_person_id,idx_role_id idx_person_id 4 const 2 -1 SIMPLE role eq_ref PRIMARY PRIMARY 4 test.userrole.role_id 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE profile NULL const PRIMARY PRIMARY 4 const 1 Using temporary; Using filesort +1 SIMPLE userrole NULL ref idx_person_id,idx_role_id idx_person_id 4 const 2 +1 SIMPLE role NULL eq_ref PRIMARY PRIMARY 4 test.userrole.role_id 1 SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6; a b 6 6 @@ -3571,22 +3571,22 @@ SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` FORCE INDEX (PRIMARY) FORCE INDEX (`b`) order by `t1`.`a` latin1 latin1_swedish_ci EXPLAIN SELECT * FROM v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 15 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 15 CREATE VIEW v2 AS SELECT * FROM t1 USE KEY () ORDER BY a; SHOW CREATE VIEW v2; View Create View character_set_client collation_connection v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` USE INDEX () order by `t1`.`a` latin1 latin1_swedish_ci EXPLAIN SELECT * FROM v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 15 Using filesort CREATE VIEW v3 AS SELECT * FROM t1 IGNORE KEY (b) ORDER BY a; SHOW CREATE VIEW v3; View Create View character_set_client collation_connection v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` IGNORE INDEX (`b`) order by `t1`.`a` latin1 latin1_swedish_ci EXPLAIN SELECT * FROM v3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 15 Using filesort DROP VIEW v1; DROP VIEW v2; DROP VIEW v3; @@ -4210,9 +4210,9 @@ INSERT INTO t2 VALUES (14,140), (15, 150), (12,120), (3,30), (17,170), (19,190); EXPLAIN EXTENDED SELECT t1.a,t2.c FROM t1,t2 WHERE t2.pk = t1.a AND t2.pk > 8; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 100.00 Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 100.00 Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`pk` = `test`.`t1`.`a` and `test`.`t1`.`a` > 8 FLUSH STATUS; @@ -4234,9 +4234,9 @@ Handler_read_rnd_next 17 CREATE VIEW v AS SELECT * FROM t2; EXPLAIN EXTENDED SELECT t1.a,v.c FROM t1,v WHERE v.pk = t1.a AND v.pk > 8; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 16 100.00 Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 100.00 Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`pk` = `test`.`t1`.`a` and `test`.`t1`.`a` > 8 FLUSH STATUS; @@ -4270,8 +4270,8 @@ CREATE VIEW v1 AS SELECT * FROM t1; EXPLAIN SELECT * FROM v1, t2, t3 WHERE t3.pk = v1.a AND t2.b = 1 AND t2.b = t3.pk AND v1.a BETWEEN 2 AND 5; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT * FROM v1, t2, t3 WHERE t3.pk = v1.a AND t2.b = 1 AND t2.b = t3.pk AND v1.a BETWEEN 2 AND 5; a pk b pk b @@ -4293,9 +4293,9 @@ a b c 2 4 2 explain extended select * from t1,t2 where t2.c=t1.a and t2.c < 3 or t2.c=t1.b and t2.c >=4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 or `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t1`.`b` >= 4 create view v1 as select * from t2; @@ -4307,9 +4307,9 @@ a b c 2 4 2 explain extended select * from t1,v1 where v1.c=t1.a and v1.c < 3 or v1.c=t1.b and v1.c >=4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 or `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t1`.`b` >= 4 create view v2 as select * from v1; @@ -4321,9 +4321,9 @@ a b c 2 4 2 explain extended select * from t1,v2 where v2.c=t1.a and v2.c < 3 or v2.c=t1.b and v2.c >=4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 or `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t1`.`b` >= 4 create view v3 as select * from t1; @@ -4335,9 +4335,9 @@ a b c 2 4 2 explain extended select * from v3,v2 where v2.c=v3.a and v2.c < 3 or v2.c=v3.b and v2.c >=4; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 or `test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t1`.`b` >= 4 drop view v1,v2,v3; @@ -4359,8 +4359,8 @@ a 7 EXPLAIN EXTENDED SELECT * FROM v1 WHERE a > -1 OR a > 6 AND a = 3; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > -1 SELECT * FROM v1 WHERE a > -1 OR a AND a = 0; @@ -4374,8 +4374,8 @@ a 7 EXPLAIN EXTENDED SELECT * FROM v1 WHERE a > -1 OR a AND a = 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > -1 CREATE VIEW v2 AS SELECT * FROM v1; @@ -4390,8 +4390,8 @@ a 7 EXPLAIN EXTENDED SELECT * FROM v2 WHERE a > -1 OR a AND a = 0; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > -1 DROP VIEW v1,v2; @@ -4417,14 +4417,14 @@ ZZ # t1 and v1 should propagate constants in the same way EXPLAIN EXTENDED SELECT * FROM v1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 13 NULL 4 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 'JJ' or `test`.`t1`.`a` = 'VV' and `test`.`t1`.`a` <> 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 13 NULL 4 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 'JJ' or `test`.`t1`.`a` = 'VV' and `test`.`t1`.`a` <> 0 # t1 and v1 should return the same result set @@ -4443,14 +4443,14 @@ ZZ # t1 and v1 should propagate constants in the same way EXPLAIN EXTENDED SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 13 NULL 4 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 'JJ' or `test`.`t1`.`a` = 'VV' and `test`.`t1`.`a` <> 0 EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > 'JJ' OR a AND a = 'VV'; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 13 NULL 4 100.00 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 13 NULL 4 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 'JJ' or `test`.`t1`.`a` = 'VV' and `test`.`t1`.`a` <> 0 DROP VIEW v1; @@ -4467,17 +4467,17 @@ CREATE VIEW v2 AS SELECT * FROM t2; EXPLAIN SELECT * FROM t1,v2 WHERE v2.a = t1.a AND v2.a = 2 AND v2.a IS NULL AND t1.a != 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT * FROM t1,v2 WHERE v2.a = t1.a AND v2.a = 2 AND v2.a IS NULL AND t1.a != 0; a a b EXPLAIN SELECT * FROM t1,v2 WHERE v2.a = t1.a AND v2.a = 2 AND v2.a+1 > 2 AND t1.a != 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) SELECT * FROM t1,v2 WHERE v2.a = t1.a AND v2.a = 2 AND v2.a+1 > 2 AND t1.a != 0; a a b @@ -4517,9 +4517,9 @@ c 1 c EXPLAIN EXTENDED SELECT * FROM v1 LEFT JOIN t2 ON t2.a = v1.a WHERE v1.b = 1 OR v1.a = 'a' AND LENGTH(v1.a) >= v1.b; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t1`.`a`) where `test`.`t1`.`b` = 1 or `test`.`t1`.`a` = 'a' and octet_length(`test`.`t1`.`a`) >= `test`.`t1`.`b` DROP VIEW v1; @@ -4535,8 +4535,8 @@ r EXPLAIN EXTENDED SELECT v1.f4 FROM v1 WHERE f1<>0 OR f2<>0 AND f4='v' AND (f2<>0 OR f3<>0 AND f5<>0 OR f4 LIKE '%b%'); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 100.00 Warnings: Note 1003 select 'r' AS `f4` from dual where 1 DROP VIEW v1; @@ -4595,11 +4595,11 @@ f1 f1 1 1 1 1 EXPLAIN EXTENDED SELECT * FROM v2 AS a1, v2 AS a2; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort -1 PRIMARY <derived5> ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) -5 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 -3 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +1 PRIMARY <derived5> NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +5 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Warnings: Note 1926 View 'test'.'v2' ORDER BY clause ignored because there is other ORDER BY clause already Note 1003 /* select#1 */ select `v1`.`f1` AS `f1`,`v1`.`f1` AS `f1` from `test`.`v1` join `test`.`v1` order by `v1`.`f1` @@ -4621,11 +4621,11 @@ EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a) WHERE t4.a >= t1.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 0.00 Const row not found -2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 DEPENDENT SUBQUERY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<expr_cache><10,`test`.`t1`.`a`>(<in_optimizer>(10,<exists>(/* select#2 */ select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond(<cache>(10) = NULL or 1) having trigcond(NULL is null)))) @@ -4637,11 +4637,11 @@ EXPLAIN EXTENDED SELECT * FROM v1, t2 WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a) WHERE t4.a >= v1.a); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 0 0.00 Const row not found -2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +2 DEPENDENT SUBQUERY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'v1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<expr_cache><10,`test`.`t1`.`a`>(<in_optimizer>(10,<exists>(/* select#2 */ select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond(<cache>(10) = NULL or 1) having trigcond(NULL is null)))) @@ -4668,11 +4668,11 @@ EXPLAIN EXTENDED SELECT * FROM t3 , t4 WHERE t4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d ) WHERE t2.b > t4.b); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00 -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1276 Field or reference 'test.t4.b' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where `test`.`t4`.`c` <= <expr_cache><`test`.`t4`.`b`>((/* select#2 */ select 0 from dual where 7 > `test`.`t4`.`b`)) @@ -4685,11 +4685,11 @@ EXPLAIN EXTENDED SELECT * FROM t3, v4 WHERE v4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d ) WHERE t2.b > v4.b); -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00 -1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00 -2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY t1 NULL system NULL NULL NULL NULL 0 0.00 Const row not found Warnings: Note 1276 Field or reference 'v4.b' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where `test`.`t4`.`c` <= <expr_cache><`test`.`t4`.`b`>((/* select#2 */ select 0 from dual where 7 > `test`.`t4`.`b`)) @@ -5477,10 +5477,10 @@ explain extended select * from t1 left join v1 on v1.c=t1.b where t1.a < 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition -1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where -1 SIMPLE t3 ref f,e e 5 test.t2.d 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 3 100.00 Using index condition +1 SIMPLE t2 NULL ref c c 5 test.t1.b 2 100.00 Using where +1 SIMPLE t3 NULL ref f,e e 5 test.t2.d 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`e` = `test`.`t2`.`d` and `test`.`t3`.`f` is not null and `test`.`t1`.`b` is not null and `test`.`t2`.`d` is not null) where `test`.`t1`.`a` < 5 explain extended @@ -5488,20 +5488,20 @@ select * from t1 left join ( t2 left join t3 on t3.e=t2.d ) on t2.c=t1.b and t3.f is not null where t1.a < 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition -1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where -1 SIMPLE t3 ref f,e e 5 test.t2.d 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 3 100.00 Using index condition +1 SIMPLE t2 NULL ref c c 5 test.t1.b 2 100.00 Using where +1 SIMPLE t3 NULL ref f,e e 5 test.t2.d 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`e` = `test`.`t2`.`d` and `test`.`t3`.`f` is not null and `test`.`t1`.`b` is not null and `test`.`t2`.`d` is not null) where `test`.`t1`.`a` < 5 explain extended select * from t1 left join v1 on v1.c=t1.b and v1.f=t1.a where t1.a < 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition -1 SIMPLE t3 eq_ref f,e f 4 test.t1.a 1 100.00 Using where -1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 3 100.00 Using index condition +1 SIMPLE t3 NULL eq_ref f,e f 4 test.t1.a 1 100.00 Using where +1 SIMPLE t2 NULL ref c c 5 test.t1.b 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`f` = `test`.`t1`.`a` and `test`.`t2`.`d` = `test`.`t3`.`e` and `test`.`t1`.`a` is not null and `test`.`t1`.`a` is not null and `test`.`t1`.`b` is not null) where `test`.`t1`.`a` < 5 explain extended @@ -5509,10 +5509,10 @@ select * from t1 left join ( t2 left join t3 on t3.e=t2.d ) on t2.c=t1.b and t3.f=t1.a and t3.f is not null where t1.a < 5; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range a a 5 NULL 3 100.00 Using index condition -1 SIMPLE t3 eq_ref f,e f 4 test.t1.a 1 100.00 Using where -1 SIMPLE t2 ref c c 5 test.t1.b 2 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 3 100.00 Using index condition +1 SIMPLE t3 NULL eq_ref f,e f 4 test.t1.a 1 100.00 Using where +1 SIMPLE t2 NULL ref c c 5 test.t1.b 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`c` = `test`.`t1`.`b` and `test`.`t3`.`f` = `test`.`t1`.`a` and `test`.`t2`.`d` = `test`.`t3`.`e` and `test`.`t1`.`a` is not null and `test`.`t1`.`a` is not null and `test`.`t1`.`b` is not null) where `test`.`t1`.`a` < 5 drop view v1; @@ -5728,9 +5728,9 @@ ON t36.f36 = t59.f59 LEFT JOIN v60 ON t36.f36 = v60.f60 ; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21, t22, t23, t24, t25, t26, t27, @@ -5764,9 +5764,9 @@ insert into t2 values (1,2), (3,4), (3,3), (5,6), (7,8), (9,10); create algorithm=merge view v1 as select t1.a as a, (select max(b) from t2 where t1.a=t2.a) as c from t1; explain extended select * from v1; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +3 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>((/* select#3 */ select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t1` @@ -5780,10 +5780,10 @@ a c 9 10 explain extended select * from t2, v1 where t2.a=v1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) -3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +3 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2 Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>((/* select#3 */ select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`a` @@ -5799,10 +5799,10 @@ a b a c 9 10 9 10 explain extended select * from t1, v1 where t1.a=v1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) -3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +3 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>((/* select#3 */ select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t1` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t1`.`a` @@ -5818,10 +5818,10 @@ a b a c 9 10 9 10 explain extended select * from t1, v1 where t1.b=v1.c; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) -3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +3 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2 Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>((/* select#3 */ select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t1` join `test`.`t1` where `test`.`t1`.`b` = <expr_cache><`test`.`t1`.`a`>((/* select#3 */ select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)) @@ -5835,11 +5835,11 @@ a b a c 9 10 9 10 explain extended select * from t2, t1, v1 where t1.a=t2.a and t1.a=v1.a; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (incremental, BNL join) -3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 6 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (incremental, BNL join) +3 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2 Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>((/* select#3 */ select max(`test`.`t2`.`b`) from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)) AS `c` from `test`.`t2` join `test`.`t1` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`a` = `test`.`t2`.`a` diff --git a/mysql-test/main/view_grant.result b/mysql-test/main/view_grant.result index c31ba882e76..f548637027a 100644 --- a/mysql-test/main/view_grant.result +++ b/mysql-test/main/view_grant.result @@ -143,8 +143,8 @@ grant select on mysqltest.t1 to mysqltest_1@localhost; revoke select on mysqltest.v5 from mysqltest_1@localhost; connection user1; explain select c from mysqltest.v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found show create view mysqltest.v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci @@ -166,15 +166,15 @@ connection root; grant show view on mysqltest.* to mysqltest_1@localhost; connection user1; explain select c from mysqltest.v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found show create view mysqltest.v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci explain select c from mysqltest.v2; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found -2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL system NULL NULL NULL NULL 0 Const row not found +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table show create view mysqltest.v2; View Create View character_set_client collation_connection v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v2` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci @@ -1206,8 +1206,8 @@ connection test11765687; select * from v1; i explain select * from v1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found disconnect test11765687; ... as eugene connect test11765687,localhost,eugene,,mysqltest1; @@ -1254,13 +1254,13 @@ ERROR 42000: SELECT command denied to user 'han'@'localhost' for table 't3' select k from t3; k explain select k from t3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL system NULL NULL NULL NULL 0 Const row not found select * from v3; k explain select * from v3; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t3 NULL system NULL NULL NULL NULL 0 Const row not found disconnect test11765687; ... as inga connect test11765687,localhost,inga,,mysqltest1; @@ -1300,9 +1300,9 @@ connection test11765687; select * from v2; i j explain select * from v2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found -1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 Const row not found disconnect test11765687; ... as noam connect test11765687,localhost,noam,,mysqltest1; diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index 1cf03adb887..df66da9dd1a 100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@ -3130,16 +3130,16 @@ sum(max(id)) over (order by max(id)) 4 explain select sum(max(id)) over (order by max(id)) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using temporary create index idx on t1(id); select sum(max(id)) over (order by max(id)) from t1; sum(max(id)) over (order by max(id)) 4 explain select sum(max(id)) over (order by max(id)) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used select sum(max(id)) over (order by max(id)) from t1 where id < 3; sum(max(id)) over (order by max(id)) 2 @@ -3462,8 +3462,8 @@ drop table t1; create table t1 (a int); explain select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup; 1 row_number() over (order by 1) drop table t1; @@ -3471,8 +3471,8 @@ explain SELECT DISTINCT BIT_OR(100) OVER () FROM dual GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP HAVING @A := 'qwerty'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING SELECT DISTINCT BIT_OR(100) OVER () FROM dual GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP HAVING @A := 'qwerty'; @@ -3481,8 +3481,8 @@ explain SELECT DISTINCT BIT_OR(100) OVER () FROM dual GROUP BY LEFT('2018-08-24', 100) HAVING @A := 'qwerty'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING SELECT DISTINCT BIT_OR(100) OVER () FROM dual GROUP BY LEFT('2018-08-24', 100) HAVING @A := 'qwerty'; @@ -3491,8 +3491,8 @@ create table t1 (a int); explain SELECT DISTINCT BIT_OR(100) OVER () FROM t1 GROUP BY LEFT('2018-08-24', 100) having 1=1 limit 0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Zero limit drop table t1; # # MDEV-13170: Database service (MySQL) stops after update with trigger @@ -3535,8 +3535,8 @@ CREATE TABLE t1 (b1 text NOT NULL); INSERT INTO t1 VALUES ('2'),('1'); EXPLAIN SELECT DISTINCT MIN(b1) OVER () FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using temporary SELECT DISTINCT MIN(b1) OVER () FROM t1; MIN(b1) OVER () 1 @@ -3548,9 +3548,9 @@ create table t1 (id int, n1 int); insert into t1 values (1,1), (2,1), (3,2), (4,4); create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1; explain select * from v1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 -2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 4 Using temporary select * from v1; ifnull(max(n1) over (partition by n1),'aaa') 1 @@ -3596,9 +3596,9 @@ explain (SELECT AVG(0) OVER (), MAX('2') FROM t1) UNION ALL (SELECT AVG(0) OVER (), MAX('2') FROM t1); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used (SELECT AVG(0) OVER (), MAX('2') FROM t1) UNION ALL (SELECT AVG(0) OVER (), MAX('2') FROM t1); @@ -3613,16 +3613,16 @@ CREATE TABLE t1 (b1 int, b2 int); INSERT INTO t1 VALUES (1,1),(0,0); explain SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1; b1 0 1 explain SELECT b1 from t1 order by row_number() over (ORDER BY b2); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using temporary; Using filesort SELECT b1 from t1 order by row_number() over (ORDER BY b2); b1 0 @@ -3632,8 +3632,8 @@ CREATE TABLE t1 (a int, b int, c int); INSERT INTO t1 VALUES (2,3,207), (1,21,909), (7,13,312), (8,64,248); explain SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using temporary; Using filesort SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); a b c 1 21 909 @@ -3642,8 +3642,8 @@ a b c 8 64 248 explain SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using temporary; Using filesort SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c); x b c 1 21 909 @@ -3685,8 +3685,8 @@ create table t1 (id int, n1 int); insert into t1 values (1,1),(2,1),(3,2),(4,4); explain select max(n1) over (partition by 'abc') from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using temporary select max(n1) over (partition by 'abc') from t1; max(n1) over (partition by 'abc') 4 @@ -3695,8 +3695,8 @@ max(n1) over (partition by 'abc') 4 explain select rank() over (partition by 'abc' order by 'xyz') from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using temporary select rank() over (partition by 'abc' order by 'xyz') from t1; rank() over (partition by 'abc' order by 'xyz') 1 @@ -3733,8 +3733,8 @@ CREATE TABLE t1 (a INT); # explain SELECT row_number() over(), sum(1) FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found; Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 Const row not found; Using temporary SELECT row_number() over(), sum(1) FROM t1; row_number() over() sum(1) 1 NULL @@ -3744,8 +3744,8 @@ insert into t1 values (2); # The expected result here is 1, NULL # EXPLAIN SELECT row_number() over(), sum(1) FROM t1 where a=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT row_number() over(), sum(1) FROM t1 where a=1; row_number() over() sum(1) 1 NULL @@ -3754,8 +3754,8 @@ row_number() over() sum(1) # Empty result is expected # EXPLAIN SELECT row_number() over(), sum(1) FROM t1 where a=1 having 1=0; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING SELECT row_number() over(), sum(1) FROM t1 where a=1 having 1=0; row_number() over() sum(1) # @@ -3763,8 +3763,8 @@ row_number() over() sum(1) # The expected result here is 1, 2 # EXPLAIN SELECT row_number() over(), sum(a) FROM t1 where a=2; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 Using temporary SELECT row_number() over(), sum(a) FROM t1 where a=2; row_number() over() sum(a) 1 2 @@ -3778,8 +3778,8 @@ insert into t1 values (1); # Expected result is NULL, 0, NULL # EXPLAIN SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE; MAX(a) OVER () COUNT(a) abs(a) NULL 0 NULL @@ -3788,8 +3788,8 @@ NULL 0 NULL # EXPLAIN SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE; MAX(1) OVER () COUNT(a) abs(a) 1 0 NULL diff --git a/mysql-test/main/win_big-mdev-11697.result b/mysql-test/main/win_big-mdev-11697.result index e8034e67aaf..17a10e9c8d3 100644 --- a/mysql-test/main/win_big-mdev-11697.result +++ b/mysql-test/main/win_big-mdev-11697.result @@ -16,9 +16,9 @@ Table Op Msg_type Msg_text test.test_table analyze status Engine-independent statistics collected test.test_table analyze status OK explain select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 1000 -2 DERIVED test_table ALL NULL NULL NULL NULL 1000 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 1000 +2 DERIVED test_table NULL ALL NULL NULL NULL NULL 1000 Using temporary; Using filesort select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10; id next_id 1 2 @@ -49,9 +49,9 @@ Table Op Msg_type Msg_text test.test_table analyze status Engine-independent statistics collected test.test_table analyze status OK explain select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> ALL NULL NULL NULL NULL 100000 -2 DERIVED test_table ALL NULL NULL NULL NULL 100000 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 100000 +2 DERIVED test_table NULL ALL NULL NULL NULL NULL 100000 Using temporary; Using filesort flush status; select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10; id next_id diff --git a/mysql-test/main/win_ntile.result b/mysql-test/main/win_ntile.result index 4d02a230e13..94c39234fd4 100644 --- a/mysql-test/main/win_ntile.result +++ b/mysql-test/main/win_ntile.result @@ -413,9 +413,9 @@ explain select pk, a, b, ntile((select a from t1 where pk=13)) over (partition by b order by pk) from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using temporary -2 SUBQUERY t1 const PRIMARY PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 Using temporary +2 SUBQUERY t1 NULL const PRIMARY PRIMARY 4 const 1 select a from t1; a 0 diff --git a/mysql-test/main/xtradb_mrr.result b/mysql-test/main/xtradb_mrr.result index 34fd8300423..19461e00160 100644 --- a/mysql-test/main/xtradb_mrr.result +++ b/mysql-test/main/xtradb_mrr.result @@ -185,8 +185,8 @@ select 'zz-1',NULL,'cc-2', 'filler-data' from t2 order by a limit 500; explain select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1' or c='no-such-row2'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 range idx1 idx1 29 NULL 16 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL range idx1 idx1 29 NULL 16 Using index condition; Rowid-ordered scan select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1' or c='no-such-row2'); a b c filler @@ -207,8 +207,8 @@ NULL NULL NULL NULL-2 NULL NULL NULL NULL-1 explain select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 range idx1 idx1 29 NULL 32 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t4 NULL range idx1 idx1 29 NULL 32 Using index condition; Rowid-ordered scan select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); a b c filler b-1 NULL c-1 NULL-15 @@ -312,8 +312,8 @@ concat('c-', 1000 + C.a, '-c'), from t1 A, t1 B, t1 C; explain select count(length(a) + length(filler)) from t2 force index (a) where a>='a-1000-a' and a <'a-1001-a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 9 NULL 100 Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range a a 9 NULL 100 Using index condition; Rowid-ordered scan select count(length(a) + length(filler)) from t2 force index (a) where a>='a-1000-a' and a <'a-1001-a'; count(length(a) + length(filler)) 100 @@ -322,8 +322,8 @@ create table t2 (a char(100), b char(100), c char(100), d int, filler char(10), key(d), primary key (a,b,c)) engine= innodb; insert into t2 select A.a, B.a, B.a, A.a, 'filler' from t1 A, t1 B; explain select * from t2 force index (d) where d < 10; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range d d 5 NULL # Using index condition; Rowid-ordered scan +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 NULL range d d 5 NULL # Using index condition; Rowid-ordered scan drop table t2; drop table t1; set @@mrr_buffer_size= @mrr_buffer_size_save; @@ -401,8 +401,8 @@ id 60 This must show type=index, extra=Using where explain SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE parent_id IS NOT NULL ORDER BY id DESC LIMIT 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 1 Using where SELECT * FROM t1 WHERE parent_id IS NOT NULL ORDER BY id DESC LIMIT 1; id parent_id name 60 40 F @@ -751,8 +751,8 @@ insert into t1(pk,b) values (3, 30), (2, 20), (9, 90), (7, 70), (4, 40), (5, 50) set @bug665669_tmp=@@optimizer_switch; set optimizer_switch='mrr=off'; explain select * from t1 where b > 1000; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 1 Using index condition # The following two must produce indentical results: select * from t1 where pk < 2 or pk between 3 and 4; pk b c diff --git a/mysql-test/main/xtradb_mrr.test b/mysql-test/main/xtradb_mrr.test index 9de9b192b06..c8d3fa463d5 100644 --- a/mysql-test/main/xtradb_mrr.test +++ b/mysql-test/main/xtradb_mrr.test @@ -41,7 +41,7 @@ drop table t2; create table t2 (a char(100), b char(100), c char(100), d int, filler char(10), key(d), primary key (a,b,c)) engine= innodb; insert into t2 select A.a, B.a, B.a, A.a, 'filler' from t1 A, t1 B; ---replace_column 9 # +--replace_column 10 # explain select * from t2 force index (d) where d < 10; drop table t2; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 60d5e4e151d..0463db0865e 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2722,14 +2722,11 @@ void THD::make_explain_field_list(List<Item> &field_list, uint8 explain_flags, Item_empty_string(this, "table", NAME_CHAR_LEN, cs), mem_root); item->set_maybe_null(); - if (explain_flags & DESCRIBE_PARTITIONS) - { - /* Maximum length of string that make_used_partitions_str() can produce */ - item= new (mem_root) Item_empty_string(this, "partitions", - MAX_PARTITIONS * (1 + FN_LEN), cs); - field_list.push_back(item, mem_root); - item->set_maybe_null(); - } + /* Maximum length of string that make_used_partitions_str() can produce */ + item= new (mem_root) Item_empty_string(this, "partitions", + MAX_PARTITIONS * (1 + FN_LEN), cs); + field_list.push_back(item, mem_root); + item->set_maybe_null(); field_list.push_back(item= new (mem_root) Item_empty_string(this, "type", 10, cs), mem_root); diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 883e679c09d..19fdfb84c8d 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -353,16 +353,11 @@ int print_explain_row(select_result_sink *result, mem_root); item_list.push_back(new (mem_root) Item_string_sys(thd, table_name), mem_root); - if (options & DESCRIBE_PARTITIONS) - { - if (partitions) - { - item_list.push_back(new (mem_root) Item_string_sys(thd, partitions), - mem_root); - } - else - item_list.push_back(item_null, mem_root); - } + if (partitions) + item_list.push_back(new (mem_root) Item_string_sys(thd, partitions), + mem_root); + else + item_list.push_back(item_null, mem_root); const char *jtype_str= join_type_str[jtype]; item_list.push_back(new (mem_root) Item_string_sys(thd, jtype_str), @@ -530,8 +525,7 @@ int Explain_union::print_explain(Explain_query *query, mem_root); /* `partitions` column */ - if (explain_flags & DESCRIBE_PARTITIONS) - item_list.push_back(item_null, mem_root); + item_list.push_back(item_null, mem_root); /* `type` column */ push_str(thd, &item_list, join_type_str[JT_ALL]); @@ -797,8 +791,7 @@ int Explain_select::print_explain(Explain_query *query, mem_root); for (uint i=0 ; i < 7; i++) item_list.push_back(item_null, mem_root); - if (explain_flags & DESCRIBE_PARTITIONS) - item_list.push_back(item_null, mem_root); + item_list.push_back(item_null, mem_root); /* filtered */ if (is_analyze || explain_flags & DESCRIBE_EXTENDED) @@ -1297,15 +1290,10 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai push_string(thd, &item_list, &table_name); /* `partitions` column */ - if (explain_flags & DESCRIBE_PARTITIONS) - { - if (used_partitions_set) - { - push_string(thd, &item_list, &used_partitions); - } - else - item_list.push_back(item_null, mem_root); - } + if (used_partitions_set) + push_string(thd, &item_list, &used_partitions); + else + item_list.push_back(item_null, mem_root); /* `type` column */ StringBuffer<64> join_type_buf; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index cf5b73fecfc..66d3d85b68e 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -26895,8 +26895,7 @@ int print_explain_message_line(select_result_sink *result, item_list.push_back(item_null, mem_root); /* `partitions` */ - if (options & DESCRIBE_PARTITIONS) - item_list.push_back(item_null, mem_root); + item_list.push_back(item_null, mem_root); /* type, possible_keys, key, key_len, ref */ for (uint i=0 ; i < 5; i++) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 7be12ccd911..c9bc2b6ada9 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -9655,6 +9655,8 @@ ST_FIELD_INFO show_explain_tabular_fields_info[]= Column("id", SLonglong(3), NULLABLE, "id"), Column("select_type", Varchar(19), NOT_NULL, "select_type"), Column("table", Name(), NULLABLE, "table"), + Column("partitions", Longtext(MAX_PARTITIONS * (1 + FN_LEN)), + NULLABLE, "partitions"), Column("type", Varchar(15), NULLABLE, "type"), Column("possible_keys",Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "possible_keys"), Column("key", Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "key"), @@ -9678,6 +9680,8 @@ ST_FIELD_INFO show_analyze_tabular_fields_info[]= Column("id", SLonglong(3), NULLABLE, "id"), Column("select_type", Varchar(19), NOT_NULL, "select_type"), Column("table", Name(), NULLABLE, "table"), + Column("partitions", Longtext(MAX_PARTITIONS * (1 + FN_LEN)), + NULLABLE, "partitions"), Column("type", Varchar(15), NULLABLE, "type"), Column("possible_keys",Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "possible_keys"), Column("key", Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "key"), diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 6fe2b462db8..5c7f2e5a34e 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -7587,7 +7587,7 @@ static void test_explain_bug() if (!opt_silent) fprintf(stdout, "\n total fields in the result: %d", mysql_num_fields(result)); - DIE_UNLESS(10 == mysql_num_fields(result)); + DIE_UNLESS(11 == mysql_num_fields(result)); verify_prepare_field(result, 0, "id", "", MYSQL_TYPE_LONGLONG, "", "", "", 3, 0); @@ -7598,34 +7598,34 @@ static void test_explain_bug() verify_prepare_field(result, 2, "table", "", MYSQL_TYPE_VAR_STRING, "", "", "", NAME_CHAR_LEN, 0); - verify_prepare_field(result, 3, "type", "", MYSQL_TYPE_VAR_STRING, + verify_prepare_field(result, 4, "type", "", MYSQL_TYPE_VAR_STRING, "", "", "", 10, 0); - verify_prepare_field(result, 4, "possible_keys", "", MYSQL_TYPE_VAR_STRING, + verify_prepare_field(result, 5, "possible_keys", "", MYSQL_TYPE_VAR_STRING, "", "", "", NAME_CHAR_LEN*MAX_KEY, 0); - verify_prepare_field(result, 5, "key", "", MYSQL_TYPE_VAR_STRING, + verify_prepare_field(result, 6, "key", "", MYSQL_TYPE_VAR_STRING, "", "", "", NAME_CHAR_LEN, 0); if (mysql_get_server_version(mysql) <= 50000) { - verify_prepare_field(result, 6, "key_len", "", MYSQL_TYPE_LONGLONG, "", + verify_prepare_field(result, 7, "key_len", "", MYSQL_TYPE_LONGLONG, "", "", "", 3, 0); } else { - verify_prepare_field(result, 6, "key_len", "", MYSQL_TYPE_VAR_STRING, "", + verify_prepare_field(result, 7, "key_len", "", MYSQL_TYPE_VAR_STRING, "", "", "", NAME_CHAR_LEN*MAX_KEY, 0); } /* The length of this may verify between MariaDB versions (1024 / 2048) */ - verify_prepare_field(result, 7, "ref", "", MYSQL_TYPE_VAR_STRING, + verify_prepare_field(result, 8, "ref", "", MYSQL_TYPE_VAR_STRING, "", "", "", NAME_CHAR_LEN * HA_MAX_KEY_SEG, 0); - verify_prepare_field(result, 8, "rows", "", MYSQL_TYPE_VAR_STRING, + verify_prepare_field(result, 9, "rows", "", MYSQL_TYPE_VAR_STRING, "", "", "", NAME_CHAR_LEN, 0); - verify_prepare_field(result, 9, "Extra", "", MYSQL_TYPE_VAR_STRING, + verify_prepare_field(result, 10, "Extra", "", MYSQL_TYPE_VAR_STRING, "", "", "", 255, 0); mysql_free_result(result); @@ -21003,10 +21003,10 @@ static void test_explain_meta() num_fields= mysql_stmt_field_count(stmt); mct_log("EXPALIN number of fields: %d\n", (int) num_fields); - if (num_fields != 10) + if (num_fields != 11) { mct_close_log(); - DIE("num_fields != 10"); + DIE("num_fields != 11"); } print_metadata(rs_metadata, num_fields); mysql_free_result(rs_metadata); @@ -21038,10 +21038,10 @@ static void test_explain_meta() num_fields= mysql_stmt_field_count(stmt); mct_log("ANALYZE number of fields: %d\n", (int) num_fields); - if (num_fields != 13) + if (num_fields != 14) { mct_close_log(); - DIE("num_fields != 13"); + DIE("num_fields != 14"); } print_metadata(rs_metadata, num_fields); mysql_free_result(rs_metadata); @@ -21075,10 +21075,10 @@ static void test_explain_meta() num_fields= mysql_stmt_field_count(stmt); mct_log("EXPALIN INSERT number of fields: %d\n", (int) num_fields); - if (num_fields != 10) + if (num_fields != 11) { mct_close_log(); - DIE("num_fields != 10"); + DIE("num_fields != 11"); } print_metadata(rs_metadata, num_fields); mysql_free_result(rs_metadata); @@ -21110,10 +21110,10 @@ static void test_explain_meta() num_fields= mysql_stmt_field_count(stmt); mct_log("ANALYZE INSERT number of fields: %d\n", (int) num_fields); - if (num_fields != 13) + if (num_fields != 14) { mct_close_log(); - DIE("num_fields != 13"); + DIE("num_fields != 14"); } print_metadata(rs_metadata, num_fields); mysql_free_result(rs_metadata); @@ -21145,10 +21145,10 @@ static void test_explain_meta() num_fields= mysql_stmt_field_count(stmt); mct_log("EXPALIN UPDATE number of fields: %d\n", (int) num_fields); - if (num_fields != 10) + if (num_fields != 11) { mct_close_log(); - DIE("num_fields != 10"); + DIE("num_fields != 11"); } print_metadata(rs_metadata, num_fields); mysql_free_result(rs_metadata); @@ -21180,10 +21180,10 @@ static void test_explain_meta() num_fields= mysql_stmt_field_count(stmt); mct_log("ANALYZE UPDATE number of fields: %d\n", (int) num_fields); - if (num_fields != 13) + if (num_fields !=14) { mct_close_log(); - DIE("num_fields != 13"); + DIE("num_fields != 14"); } print_metadata(rs_metadata, num_fields); mysql_free_result(rs_metadata); @@ -21215,10 +21215,10 @@ static void test_explain_meta() num_fields= mysql_stmt_field_count(stmt); mct_log("EXPALIN DELETE number of fields: %d\n", (int) num_fields); - if (num_fields != 10) + if (num_fields != 11) { mct_close_log(); - DIE("num_fields != 10"); + DIE("num_fields != 11"); } print_metadata(rs_metadata, num_fields); mysql_free_result(rs_metadata); @@ -21250,10 +21250,10 @@ static void test_explain_meta() num_fields= mysql_stmt_field_count(stmt); mct_log("ANALYZE DELETE number of fields: %d\n", (int) num_fields); - if (num_fields != 13) + if (num_fields != 14) { mct_close_log(); - DIE("num_fields != 13"); + DIE("num_fields != 14"); } print_metadata(rs_metadata, num_fields); mysql_free_result(rs_metadata);
participants (1)
-
psergey